Files
Reflect/Shared/Models/Mood.swift
2022-01-19 09:54:52 -06:00

99 lines
2.2 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
var strValue: String {
switch self {
case .horrible:
return "Horrible"
case .bad:
return "Bad"
case .average:
return "Average"
case .good:
return "Good"
case .great:
return "Great"
case .missing:
return "Missing"
}
}
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.tertiarySystemBackground)
}
}
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)
}
}
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)
}
}
}
extension Mood: Identifiable {
var id: Int {
rawValue
}
}