//
//  ContentDetailPurchaseButton.swift
//  SodaLive
//
//  Created by klaus on 2023/08/13.
//

import SwiftUI

struct ContentDetailPurchaseButton: View {
    
    let price: Int
    let isOnlyRental: Bool
    
    var body: some View {
        HStack(spacing: 0) {
            if UserDefaults.int(forKey: .userId) != 17958 {
                Image("ic_can")
                    .resizable()
                    .frame(width: 16.7, height: 16.7)
            }
            
            Text(UserDefaults.int(forKey: .userId) == 17958 ? "\(price * 110)" : "\(price)")
                .font(.custom(Font.bold.rawValue, size: 14.7))
                .foregroundColor(.white)
                .padding(.leading, 5.3)
            
            Text(UserDefaults.int(forKey: .userId) == 17958 ? "원으로": "캔으로")
                .font(.custom(Font.light.rawValue, size: 12))
                .foregroundColor(.white)
            
            Text(isOnlyRental ? " 대여하기" : " 구매하기")
                .font(.custom(Font.bold.rawValue, size: 14.7))
                .foregroundColor(.white)
        }
        .frame(maxWidth: .infinity)
        .frame(height: 48.7)
        .background(Color.button)
        .cornerRadius(5.3)
        .padding(.top, 18.3)
    }
}
