import SwiftUI

struct OutOfCreditsUpsellBanner: View {
    let onUpgrade: () -> Void
    
    var body: some View {
        HStack(spacing: 0) {
            Spacer()
            
            HStack(spacing: 0) {
                Text("You've run out of credits. ")
                    .font(Constants.Typography.xSmallRegular)
                    .foregroundColor(Constants.Colors.Foreground.primary)
                    .tracking(0.24)
                
                Button(action: onUpgrade) {
                    Text("Upgrade")
                        .font(Constants.Typography.xSmallRegular)
                        .foregroundColor(Constants.Colors.Foreground.primary)
                        .tracking(0.24)
                        .underline()
                }
                .buttonStyle(PlainButtonStyle())
            }
            
            Spacer()
        }
        .frame(height: 40)
        .frame(maxWidth: .infinity)
        .background(Constants.Colors.Background.Fog.thin)
    }
}

#Preview {
    OutOfCreditsUpsellBanner {
        print("Upgrade tapped")
    }
    .background(Constants.Colors.Background.primary)
}
