import Foundation

enum StreamErrorType: String, Stateable, CaseIterable {
    case badFormat = "bad-format"
    case badNamespacePrefix = "bad-namespace-prefix"
    case conflict
    case connectionTimeout = "connection-timeout"
    case hostGone = "host-gone"
    case hostUnknown = "host-unknown"
    case improperAddressing = "improper-addressing"
    case internalServerError = "internal-server-error"
    case invalidFrom = "invalid-from"
    case invalidId = "invalid-id"
    case invalidNamespace = "invalid-namespace"
    case invalidXml = "invalid-xml"
    case notAuthorized = "not-authorized"
    case notWellFormed = "not-well-formed"
    case policyViolation = "policy-violation"
    case remoteConnectionFailed = "remote-connection-failed"
    case reset
    case resourceConstraint = "resource-constraint"
    case restrictedXml = "restricted-xml"
    case seeOtherHost = "see-other-host"
    case systemShutdown = "system-shutdown"
    case undefinedCondition = "undefined-condition"
    case unsupportedEncoding = "unsupported-encoding"
    case unsupportedStanzaType = "unsupported-stanza-type"
    case unsupportedVersion = "unsupported-version"
    case unknown
}

struct StreamError: Stateable {
    let type: StreamErrorType
    let text: String?
}
