//
//  Font.Design.swift
//  TheNoiseClock
//
//  Created by Matt Bruce on 9/11/25.
//
import SwiftUI

extension Font.Design: @retroactive RawRepresentable, @retroactive CaseIterable {
    public init?(rawValue: String) {
        switch rawValue {
        case "Default": self = .default
        case "Serif": self = .serif
        case "Rounded": self = .rounded
        case "Monospaced": self = .monospaced
        default: self = .rounded
        }
    }
    public var rawValue: String {
        switch self {
        case .default: return "Default"
        case .serif: return "Serif"
        case .rounded: return "Rounded"
        case .monospaced: return "Monospaced"
        @unknown default: return "Default"
        }
    }
    
    public static var allCases: [Font.Design] {
        [.default, .rounded, .monospaced, .serif]
    }
    
    var uiFontWidth: UIFont.Width {
        switch self {
        case .default: return .standard
        case .rounded: return .standard
        case .monospaced: return .condensed
        case .serif: return .standard
        @unknown default:
            return .standard
        }
    }
}
