//
//  CozySwipeButtons.swift
//  lichunWebsocket
//
//  Large, colorful action buttons for dating swipe interface
//

import SwiftUI

struct CozySwipeButtons: View {
    let onReject: () -> Void
    let onAccept: () -> Void
    var isDisabled: Bool = false

    var body: some View {
        HStack(spacing: AppSpacing.xl) {
            // Reject button (X)
            Button(action: {
                if !isDisabled {
                    hapticFeedback(style: .medium)
                    onReject()
                }
            }) {
                Image(systemName: "xmark")
                    .font(.system(size: 28, weight: .bold))
                    .foregroundColor(.white)
                    .frame(width: 70, height: 70)
                    .background(
                        Circle()
                            .fill(
                                LinearGradient(
                                    colors: [
                                        AppColors.error,
                                        AppColors.error.darker(by: 0.1)
                                    ],
                                    startPoint: .topLeading,
                                    endPoint: .bottomTrailing
                                )
                            )
                    )
                    .shadow(color: AppColors.error.opacity(0.5), radius: AppSpacing.Shadow.radiusMedium, x: 0, y: AppSpacing.Shadow.offsetY)
                    .shadow(color: AppColors.error.opacity(0.25), radius: AppSpacing.Shadow.radiusSoft, x: 0, y: 3)
            }
            .buttonStyle(SquishButtonStyle())
            .scaleEffect(1.1)
            .disabled(isDisabled)

            Spacer()

            // Accept button (Heart)
            Button(action: {
                if !isDisabled {
                    hapticFeedback(style: .medium)
                    onAccept()
                }
            }) {
                Image(systemName: "heart.fill")
                    .font(.system(size: 28, weight: .bold))
                    .foregroundColor(.white)
                    .frame(width: 70, height: 70)
                    .background(
                        Circle()
                            .fill(
                                LinearGradient(
                                    colors: [
                                        AppColors.primary,
                                        AppColors.primary.darker(by: 0.1)
                                    ],
                                    startPoint: .topLeading,
                                    endPoint: .bottomTrailing
                                )
                            )
                    )
                    .shadow(color: AppColors.primary.opacity(0.5), radius: AppSpacing.Shadow.radiusMedium, x: 0, y: AppSpacing.Shadow.offsetY)
                    .shadow(color: AppColors.primary.opacity(0.25), radius: AppSpacing.Shadow.radiusSoft, x: 0, y: 3)
            }
            .buttonStyle(SquishButtonStyle())
            .scaleEffect(1.1)
            .disabled(isDisabled)
        }
        .padding(.horizontal, AppSpacing.xl)
        .opacity(isDisabled ? 0.5 : 1.0)
    }
}

// MARK: - Preview
#if DEBUG
struct CozySwipeButtons_Previews: PreviewProvider {
    static var previews: some View {
        VStack {
            Spacer()
            CozySwipeButtons(
                onReject: { print("Rejected") },
                onAccept: { print("Accepted") }
            )
            .padding()
        }
        .background(AppColors.background)
    }
}
#endif
