//
//  SummaryStatus.swift
//  dns
//
//  Created by Benjamin Erhart on 15.04.26.
//

import SwiftUI

struct Status: Codable {

    let summaryStatus: SummaryStatus
}

enum SummaryStatus: String, Codable, CustomStringConvertible {

    case pending
    case ok
    case notice
    case disrupted
    case down

    var description: String {
        switch self {
        case .pending:
            return NSLocalizedString("Fetching service status", comment: "")

        case .ok:
            return NSLocalizedString("No issues detected", comment: "")

        case .notice:
            return NSLocalizedString("In maintenance", comment: "")

        case .disrupted:
            return NSLocalizedString("Service disruption", comment: "")

        case .down:
            return NSLocalizedString("Service down", comment: "")
        }
    }

    var color: Color {
        switch self {
        case .pending:
            return .gray

        case .ok:
            return .green

        case .notice, .disrupted:
            return .orange

        case .down:
            return .red
        }
    }

}
