//
//  FontStyle.swift
//  forShip
//
//  Created by Mamoru Sugita on 2023/10/13.
//

import Foundation
import SwiftUI


    
enum FontStyle: String, CaseIterable{
    //見出し
    case TitleL
    case TitleM
    case TitleS
    case TitleSBold
    
    //本文
    ///本文内で強調する文字
    case EmphasisText
    ///本文のデフォルト
    case DefaultText
    ///本文の補足・項目の見出しなど
    case SupplementText
    ///気象海象の単位
    case WeatherUnitText
    ///時刻などの補足情報
    case SupplementText2
    ///ログインのバージョン表示
    case VersionText
    ///アイコン付きラジオボタン
    case RadioButtonText
    
    ///日付
    case DateText
    
}

extension FontStyle{
    var weight: SwiftUI.Font.Weight {
        switch self {
        case .TitleL:
            return .bold
        case .TitleM:
            return .medium
        case .TitleS:
            return .regular
        case .TitleSBold:
            return .bold
        case .EmphasisText:
            return .bold
        case .DefaultText:
            return .medium
        case .SupplementText:
            return .regular
        case .WeatherUnitText:
            return .medium
        case .SupplementText2:
            return .regular
        case .VersionText:
            return .medium
        case .RadioButtonText:
            return .regular
        case .DateText:
            return .bold
        }
    }
    
    var font: SwiftUI.Font{
        return .system(size: self.size, weight: self.weight)
    }
    
    var size: CGFloat {
        switch self {
        case .TitleL:
            return 20
        case .TitleM:
            return 18
        case .TitleS:
            return 16
        case .TitleSBold:
            return 16
        case .EmphasisText:
            return 14
        case .DefaultText:
            return 14
        case .SupplementText:
            return 14
        case .WeatherUnitText:
            return 12
        case .SupplementText2:
            return 12
        case .VersionText:
            return 10
        case .RadioButtonText:
            return 10
        case .DateText:
            return 12
        }
    }
}
    
