//
//  Theme.swift
//  Feels (iOS)
//
//  Created by Trey Tartt on 2/4/22.
//

import SwiftUI

enum Theme: Int, CaseIterable {
    static let iconSize: CGFloat = 50
    case system
    case ifeelTheme
    
    var title: String {
        switch self {
            
        case .system:
            return "System"
        case .ifeelTheme:
            return "iFeel Theme"
        }
    }
    
    var secondaryBGColor: UIColor {
        switch self{
        case .system:
            return UIColor.secondarySystemBackground
        case .ifeelTheme:
            return UIColor.systemBackground
        }
    }
    
    var bg: some View {
        switch self {
        case .system:
            return AnyView(
                ZStack {
                    Rectangle()
                        .fill(Color(UIColor.systemBackground))
                }
            )
        case .ifeelTheme:
            return AnyView(
                BGView().equatable()
            )
        }
    }
    
    var preview: some View {
        switch self {
        case .system:
            return AnyView(
                ZStack {
                    Rectangle()
                        .fill(Color(UIColor.secondarySystemBackground))
                        .frame(width: Theme.iconSize, height: Theme.iconSize)
                        .clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
                }
            )
        case .ifeelTheme:
            return AnyView(
                ZStack {
                    BGView().equatable()
                        .frame(width: Theme.iconSize, height: Theme.iconSize)
                        .clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
                }
            )
        }
    }
}
