//
//  DesignConstants.swift
//  Baccarat
//
//  Design system constants for consistent styling across the app.
//  Uses CasinoDesign from CasinoKit for shared values, with game-specific overrides.
//

import SwiftUI
import CasinoKit

/// Design constants for the Baccarat app.
/// Shared constants are imported from CasinoDesign; game-specific values are defined here.
enum Design {
    
    /// Set to true to show layout debug borders on views
    static let showDebugBorders = false
    
    // MARK: - Shared Constants (from CasinoKit)
    
    typealias Spacing = CasinoDesign.Spacing
    typealias CornerRadius = CasinoDesign.CornerRadius
    typealias LineWidth = CasinoDesign.LineWidth
    typealias Shadow = CasinoDesign.Shadow
    typealias Opacity = CasinoDesign.Opacity
    typealias Animation = CasinoDesign.Animation
    typealias Scale = CasinoDesign.Scale
    typealias MinScaleFactor = CasinoDesign.MinScaleFactor
    typealias BaseFontSize = CasinoDesign.BaseFontSize
    typealias IconSize = CasinoDesign.IconSize
    
    // MARK: - Baccarat-Specific Sizes (use CasinoDesign.Size for shared values)
    
    enum Size {
        // Card display on table
        static let cardWidthTable: CGFloat = 70       // iPhone
        static let cardWidthTableiPad: CGFloat = 90   // iPad
        static let cardOverlap: CGFloat = -35         // iPhone (negative = more overlap)
        static let cardOverlapiPad: CGFloat = -45     // iPad
        
        // Table layout
        static let tableAspectRatio: CGFloat = 1.6
        static let roadMapCell: CGFloat = 16
        static let diamondIcon: CGFloat = 24
        static let topBetRowHeight: CGFloat = 40
        static let mainBetRowHeight: CGFloat = 50
        static let bonusZoneWidth: CGFloat = 80
        
        // Labels
        static let labelFontSize: CGFloat = 14
        static let labelRowHeight: CGFloat = 30
    }
}

// MARK: - Baccarat App Colors

extension Color {
    
    // MARK: - Table Colors (use CasinoTable from CasinoKit)
    
    /// Typealias for consistent table colors across all games.
    typealias Table = CasinoTable
    
    // MARK: - Border Colors (Baccarat-specific)
    
    enum Border {
        static let gold = Color(red: 0.7, green: 0.55, blue: 0.25)
        static let silver = Color(red: 0.6, green: 0.6, blue: 0.65)
    }
    
    // MARK: - Betting Zone Colors
    
    enum BettingZone {
        // Player (Blue)
        static let playerLight = Color(red: 0.1, green: 0.25, blue: 0.55)
        static let playerDark = Color(red: 0.05, green: 0.15, blue: 0.4)
        static let playerMaxLight = Color(red: 0.08, green: 0.18, blue: 0.4)
        static let playerMaxDark = Color(red: 0.04, green: 0.1, blue: 0.28)
        
        // Banker (Red)
        static let bankerLight = Color(red: 0.55, green: 0.12, blue: 0.12)
        static let bankerDark = Color(red: 0.4, green: 0.08, blue: 0.08)
        static let bankerMaxLight = Color(red: 0.4, green: 0.1, blue: 0.1)
        static let bankerMaxDark = Color(red: 0.28, green: 0.06, blue: 0.06)
        
        // Tie (Green)
        static let tie = Color(red: 0.1, green: 0.45, blue: 0.25)
        static let tieMax = Color(red: 0.08, green: 0.32, blue: 0.18)
        
        // Dragon Bonus (Purple/Blue gradient)
        static let dragonBonusLight = Color(red: 0.25, green: 0.3, blue: 0.45)
        static let dragonBonusDark = Color(red: 0.15, green: 0.2, blue: 0.35)
    }
    
}

// MARK: - Localized Strings Helper

extension String {
    
    /// Returns a localized string for the given key.
    static func localized(_ key: String) -> String {
        String(localized: String.LocalizationValue(key))
    }
    
    /// Returns a localized string with format arguments.
    static func localized(_ key: String, _ arguments: CVarArg...) -> String {
        let format = String(localized: String.LocalizationValue(key))
        return String(format: format, arguments: arguments)
    }
}
