//
//  SettingPurchaseTopView.swift
//  AIEmoji
//
//  Created by 100Years on 2025/2/4.
//
import SwiftUI
struct SettingPurchaseTopView: View {
    var eventPublisher: ListEventPublisher
    @Binding var isViper: Bool
    var body: some View {
        ZStack {
            if isViper {
                Image(.settingVipBj).resizable().frame(width: 343*kDesignScale, height: 109*kDesignScale)
                HStack {
                    Spacer().frame(width:20)
                    VStack(alignment: .leading,spacing: 16) {
                        HStack {
                            Text(" AI Ringtone Pro")
                                .font(.font(name: .PoppinsBlackItalic,size: 20))
                                .gradientForeground(
                                    colors: [Color.white, "#F7B7FF".uiColor.color],
                                    startPoint: UnitPoint.top,
                                    endPoint: UnitPoint.bottom
                                )
                                .frame(height: 20)
                            
                            Spacer()
                        }
                        
                        HStack {
                            Text("Due Date:".localized + " \(kPurchaseDefault.expiredDateString)")
                                .foregroundColor(.white.opacity(0.6))
                                .font(.font(size: 14,weight: .medium))
                                .frame(height: 14)
                            Spacer()
                        }
                    }
                    
                    Spacer()
                    
//                    Image(.vipBigIcon).resizable().frame(width: 88, height: 78)
                }
            }else {
                Image(.settingUnvipBj).resizable().frame(width: 343*kDesignScale, height: 109*kDesignScale)
                HStack {
                    Spacer().frame(width:20)
                    VStack(alignment: .leading,spacing: 16) {
                        HStack {
                            Text("Get Pro")
                                .font(.font(name: .PoppinsBlackItalic,size: 20))
                                .gradientForeground(
                                    colors: [Color.white, "#F7B7FF".uiColor.color],
                                    startPoint: UnitPoint.top,
                                    endPoint: UnitPoint.bottom
                                )
                                .frame(height: 20)
                            
                            Spacer()
                        }
                        
                        HStack {
                            Text("Limited Time Discount")
                                .font(.font(size: 14))
                                .frame(height: 14)
                                .foregroundColor(UIColor.white.withAlphaComponent(0.6).color)
                            
                            Spacer()
                        }
                    }
                    
                    Spacer()
                    
                    Text("Upgrade")
                        .font(.font(size: 14,weight: .medium))
                        .padding(EdgeInsets(top: 0, leading: 12, bottom: 0, trailing: 12))
                        .frame(height: 26) // 设置高度
                        .foregroundColor("#010101".uiColor.color)
                        .background(UIColor.themeColor.color)
                        .cornerRadius(13.0) // 圆角
                        .onTapGesture {
                            if kPurchaseDefault.isVip {
                                return
                            }
                            eventPublisher.enterPurchasePublisher.send(true)
                        }

                        Spacer().frame(width: 15)
                }
            }
        }
    }
}
