//
//  LiveRoomRouletteDonationChatItemView.swift
//  SodaLive
//
//  Created by klaus on 2023/12/07.
//

import SwiftUI
import Kingfisher

struct LiveRoomRouletteDonationChatItemView: View {
    
    let chatMessage: LiveRoomRouletteDonationChat
    
    var body: some View {
        HStack(spacing: 13.3) {
            ZStack(alignment: .bottomTrailing) {
                KFImage(URL(string: chatMessage.profileUrl))
                    .resizable()
                    .scaledToFill()
                    .frame(width: 33.3, height: 33.3, alignment: .top)
                    .clipped()
                    .cornerRadius(23.3)
                
                Image("ic_roulette")
                    .resizable()
                    .frame(width: 20, height: 20)
            }
            
            VStack(alignment: .leading, spacing: 6.7) {
                HStack(spacing: 0) {
                    Text(chatMessage.nickname)
                        .font(.custom(Font.medium.rawValue, size: 12))
                        .foregroundColor(.white)
                    
                    Text("님의 룰렛 결과?")
                        .font(.custom(Font.light.rawValue, size: 12))
                        .foregroundColor(.white)
                }
                
                HStack(spacing: 0) {
                    Text("[\(chatMessage.rouletteResult)]")
                        .font(.custom(Font.medium.rawValue, size: 13))
                        .foregroundColor(Color(hex: "ffe500"))
                    
                    Text(" 당첨!")
                        .font(.custom(Font.medium.rawValue, size: 13))
                        .foregroundColor(.white)
                }
            }
        }
        .padding(13)
        .frame(width: screenSize().width - 86, alignment: .leading)
        .background(Color(hex: "c25264"))
        .cornerRadius(10)
        .padding(.leading, 20)
    }
}

struct LiveRoomRouletteDonationChatItemView_Previews: PreviewProvider {
    static var previews: some View {
        LiveRoomRouletteDonationChatItemView(chatMessage: LiveRoomRouletteDonationChat(profileUrl: "", nickname: "유저일", rouletteResult: "옵션1"))
    }
}