//
//  ReservationStatusView.swift
//  SodaLive
//
//  Created by klaus on 2023/08/10.
//

import SwiftUI

struct ReservationStatusView: View {
    let data: MyPageResponse
    
    var body: some View {
        VStack(alignment: .leading, spacing: 13.3) {
            Text("예약현황")
                .font(.custom(Font.bold.rawValue, size: 18.3))
                .foregroundColor(Color(hex: "eeeeee"))
            
            HStack(spacing: 0) {
                let width = screenSize().width - 26.7
                
                HStack(spacing: 6.7) {
                    Image("ic_tabbar_live_selected")
                        .resizable()
                        .frame(width: 20, height: 20)
                    
                    Text("라이브")
                        .font(.custom(Font.bold.rawValue, size: 14.7))
                        .foregroundColor(Color(hex: "3bb9f1"))
                    
                    Text("\(data.liveReservationCount)")
                        .font(.custom(Font.medium.rawValue, size: 14.7))
                        .foregroundColor(Color(hex: "3bb9f1"))
                }
                .frame(width: width, height: 46.7)
                .background(Color(hex: "13181b"))
                .cornerRadius(6.7)
                .overlay(
                    RoundedRectangle(cornerRadius: 6.7)
                        .stroke(Color(hex: "3bb9f1"), lineWidth: 1.3)
                )
                .onTapGesture {
                    AppState.shared.setAppStep(step: .liveReservation)
                }
            }
        }
        .frame(width: screenSize().width - 26.7, alignment: .leading)
    }
}

struct ReservationStatusView_Previews: PreviewProvider {
    static var previews: some View {
        ReservationStatusView(
            data: MyPageResponse(
                nickname: "완다 막시모프",
                profileUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
                chargeCan: 0,
                rewardCan: 150,
                youtubeUrl: "",
                instagramUrl: "",
                websiteUrl: "",
                blogUrl: "",
                liveReservationCount: 0,
                isAuth: false,
                orderList: GetAudioContentOrderListResponse(
                    totalCount: 0,
                    items: []
                )
            )
        )
    }
}
