//
//  UserInfoView.swift
//  AcaMate
//
//  Created by TAnine on 2/13/25.
//

import SwiftUI

struct UserInfoView: View {
    @StateObject var btnVM = ButtonViewModel()
    
    @State var notifyBtnID = UUID()
    @State var userData: SummaryUser
    
    var body: some View {
        VStack(spacing: 8 ) {
            HStack(spacing: 12) {
                userData.profile.resizable()
                    .frame(width: 30, height: 30, alignment: .center)
                Text("\(userData.name)")
                    .font(.nps(font: .bold, size: 20))
                    .foregroundStyle(Color(.Text.detail))
                Spacer(minLength: 1)
                VStack(alignment: .center, spacing: 0) {
                    SimpleBtnView(vm: btnVM, id: notifyBtnID)
                    Text("알림설정")
                        .font(.nps(font: .bold, size: 8))
                        .foregroundStyle(Color(.Text.detail))
                }
            }
            VStack(spacing: 10) {
                HStack(spacing: 0) {
                    Text("ID")
                        .font(.nps(font: .bold, size: 16))
                        .foregroundStyle(Color(.Text.detail))
                    Spacer(minLength: 1)
                    Text("\(userData.userID)")
                        .font(.nps(size: 16))
                        .foregroundStyle(Color(.Text.detail))
                }
                HStack(spacing: 0) {
                    Text("E-mail")
                        .font(.nps(font: .bold, size: 16))
                        .foregroundStyle(Color(.Text.detail))
                    Spacer(minLength: 1)
                    Text("\(userData.email)")
                        .font(.nps(size: 16))
                        .foregroundStyle(Color(.Text.detail))
                        .multilineStyle()
                }
            }
            .padding(10)
        }
        .padding(12)
        .background {
            RoundedRectangle(cornerRadius: 8)
                .foregroundStyle(Color(.Other.cell))
        }
        .onAppear {
            btnVM.setImage(for: notifyBtnID, newImage: Image(.Icon.notificationSET))
            btnVM.setSize(for: notifyBtnID, newWidth: 24, newHeight: 24)
            btnVM.setAction(for: notifyBtnID) {
                // MARK: TO-DO
                // 알림 설정 페이지로 이동
                printLog("알림 설정 페이지")
            }
        }
    }
}

