//
//  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 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")
        }
    }
    
    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)
        }
    }
    
    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
    }
}
