Files
Reflect/Shared/Models/Mood.swift
Trey t 1cf38cb854 wip
2022-02-18 18:58:38 -06:00

108 lines
2.7 KiB
Swift

//
// Mood.swift
// Feels
//
// Created by Trey Tartt on 1/5/22.
//
import Foundation
import SwiftUI
enum Mood: Int {
case horrible
case bad
case average
case good
case great
case missing
case placeholder
var strValue: String {
switch self {
case .horrible:
return String(localized: "mood_value_horrible")
case .bad:
return String(localized: "mood_value_bad")
case .average:
return String(localized: "mood_value_average")
case .good:
return String(localized: "mood_value_good")
case .great:
return String(localized: "mood_value_great")
case .missing:
return String(localized: "mood_value_missing")
case .placeholder:
return String("placeholder")
}
}
var color: Color {
switch self {
case .horrible:
return .red
case .bad:
return .orange
case .average:
return .blue
case .good:
return .yellow
case .great:
return .green
case .missing:
return Color(uiColor: UIColor.systemGray2)
case .placeholder:
return .clear
}
}
static var allValues: [Mood] {
return [Mood.horrible, Mood.bad, Mood.average, Mood.good, Mood.great].reversed()
}
var icon: Image {
switch self {
case .horrible:
return Image("horrible", bundle: .main)
case .bad:
return Image("bad", bundle: .main)
case .average:
return Image("average", bundle: .main)
case .good:
return Image("good", bundle: .main)
case .great:
return Image("great", bundle: .main)
case .missing:
return Image("missing", bundle: .main)
case .placeholder:
return Image("missing", bundle: .main)
}
}
var graphic: Image {
switch self {
case .horrible:
return Image("HorribleGraphic", bundle: .main)
case .bad:
return Image("BadGraphic", bundle: .main)
case .average:
return Image("AverageGraphic", bundle: .main)
case .good:
return Image("GoodGraphic", bundle: .main)
case .great:
return Image("GreatGraphic", bundle: .main)
case .missing:
return Image("MissingGraphic", bundle: .main)
case .placeholder:
return Image("MissingGraphic", bundle: .main)
}
}
}
extension Mood: Identifiable {
var id: Int {
rawValue
}
}