import SwiftUI
import ComposeApp

struct OverviewCard: View {
    let summary: TotalSummary

    var body: some View {
        VStack(spacing: AppSpacing.lg) {
            // Header
            HStack {
                HStack(spacing: AppSpacing.sm) {
                    ZStack {
                        Circle()
                            .fill(LinearGradient(colors: [Color.appPrimary, Color.appPrimary.opacity(0.8)], startPoint: .topLeading, endPoint: .bottomTrailing))
                            .frame(width: 44, height: 44)

                        Image(systemName: "chart.bar.fill")
                            .font(.system(size: 20, weight: .semibold))
                            .foregroundColor(Color.appTextOnPrimary)
                    }

                    Text("Overview")
                        .font(.title3.weight(.semibold))
                        .foregroundColor(Color.appTextPrimary)
                }
                Spacer()
            }

            // Stats Grid
            HStack(spacing: AppSpacing.md) {
                StatView(
                    icon: "outline",
                    value: "\(summary.totalResidences)",
                    label: "Properties",
                    color: Color.appPrimary
                )

                Divider()
                    .frame(height: 60)

                StatView(
                    icon: "list.bullet",
                    value: "\(summary.totalTasks)",
                    label: "Total Tasks",
                    color: Color.appPrimary
                )

                Divider()
                    .frame(height: 60)

                StatView(
                    icon: "clock.fill",
                    value: "\(summary.totalPending)",
                    label: "Pending",
                    color: Color.appAccent
                )
            }
        }
        .padding(AppSpacing.xl)
        .background(Color.appBackgroundSecondary)
        .cornerRadius(AppRadius.xl)
        .shadow(color: AppShadow.lg.color, radius: AppShadow.lg.radius, x: AppShadow.lg.x, y: AppShadow.lg.y)
        .padding(.horizontal, AppSpacing.md)
    }
}
