//
//  Selectable.swift
//  PadelClub
//
//  Created by Razmig Sarkissian on 01/04/2024.
//

import Foundation
import SwiftUI

protocol Selectable {
    func selectionLabel() -> String
    func badgeValue() -> Int?
    func badgeImage() -> Badge?
    func badgeValueColor() -> Color?
    func displayImageIfValueZero() -> Bool
}

extension Selectable {
    func displayImageIfValueZero() -> Bool {
        return false
    }
}

enum Badge {
    case checkmark
    case xmark
    case custom(systemName: String, color: Color)
    
    func systemName() -> String {
        switch self {
        case .checkmark:
            return "checkmark.circle.fill"
        case .xmark:
            return "xmark.circle.fill"
        case .custom(let systemName, _):
            return systemName
        }
    }
    
    func color() -> Color {
        switch self {
        case .checkmark:
            .green
        case .xmark:
            .red
        case .custom(_, let color):
            color
        }
    }
}
