//
//  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 {
            Image(PurchaseManager.default.isVip ? .settingVip : .settingNoVip).resizable().frame(width: 343*kDesignScale, height: 117*kDesignScale)

            if isViper {
                VStack {
                    Spacer()
        
                    Text("Due Date:".localized + " \(PurchaseManager.default.expiredDateString)")
                        .foregroundColor(.white.opacity(0.6))
                        .font(.font(size: 14,weight: .medium))
                        .frame(height: 14)

                    Spacer().frame(height: 13)
                }
            }else {
                
                HStack {
                    Spacer()
                    
                    Text("Upgrade")
                        .font(.font(size: 14,weight: .medium))
                        .padding(EdgeInsets(top: 0, leading: 12, bottom: 0, trailing: 12))
                        .frame(height: 34)
                        .foregroundColor("#010101".uiColor.color)
                        .background(UIColor.themeColor.color)
                        .cornerRadius(14.0)
                    
                    .frame(height: 26) // 设置高度
                    .cornerRadius(14.0) // 圆角
                    .onTapGesture {
                        if PurchaseManager.default.isVip {
                            return
                        }
                        eventPublisher.enterPurchasePublisher.send(true)
                    }

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