import Foundation

enum SeedError: LocalizedError {
    case missingArguments
    case dockerExecFailed(command: String, exitCode: Int32, stderr: String)
    case dockerExecTimedOut(command: String, seconds: TimeInterval)
    case retryExhausted(operation: String, attempts: Int)

    var errorDescription: String? {
        switch self {
        case .missingArguments:
            "Usage: forgejo-seed <base-url> <service-name> [compose-file]"
        case let .dockerExecFailed(command, exitCode, stderr):
            "Docker exec failed (\(exitCode)): \(command)\n\(stderr)"
        case let .dockerExecTimedOut(command, seconds):
            "Docker exec timed out after \(Int(seconds))s: \(command)"
        case let .retryExhausted(operation, attempts):
            "\(operation) failed after \(attempts) attempts"
        }
    }
}
