//
//  QuickStatsCard.swift
//  lichunWebsocket
//
//  Quick stats display card
//

import SwiftUI

struct QuickStatsCard: View {
    @EnvironmentObject var webSocketService: WebSocketService

    var body: some View {
        BaseCard {
            VStack(spacing: AppSpacing.sm) {
                CozyStatBar(
                    label: "Health",
                    value: Int(webSocketService.person.health * 100),
                    color: AppColors.health,
                    height: 10
                )

                CozyStatBar(
                    label: "Happiness",
                    value: webSocketService.person.happiness,
                    color: AppColors.happiness,
                    height: 10
                )

                CozyStatBar(
                    label: "Intelligence",
                    value: webSocketService.person.intelligence,
                    color: AppColors.intelligence,
                    height: 10
                )

                CozyStatBar(
                    label: "Prestige",
                    value: webSocketService.person.prestige,
                    color: AppColors.prestige,
                    height: 10
                )
            }
        }
    }
}

// MARK: - Preview
#Preview {
    let service = WebSocketService(urlSession: URLSession.shared, delegateQueue: OperationQueue())
    QuickStatsCard()
        .environmentObject(service)
        .padding()
        .background(AppColors.background)
}
