cloud-dns-ios/dns/SummaryStatus.swift

59 lines
951 B
Swift
Raw Normal View History

//
// 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 "Fetching service status"
case .ok:
return "No issues detected"
case .notice:
return "In maintenance"
case .disrupted:
return "Service disruption"
case .down:
return "Service down"
}
}
var color: Color {
switch self {
case .pending:
return .gray
case .ok:
return .green
case .notice, .disrupted:
return .orange
case .down:
return .red
}
}
}