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

import SwiftUI

struct EtcBoxView<Content: View>: View {
    let title: String
    
    @ViewBuilder let content: Content
    
    
    var body: some View {
        VStack(spacing: 24) {
            Text("\(title)")
                .font(.nps(font: .bold, size: 24))
                .foregroundStyle(Color(.Text.detail))
                .frame(maxWidth: .infinity, alignment: .leading)
            content
                .padding([.leading,.trailing],24)
                .background {
                    RoundedRectangle(cornerRadius: 8)
                        .foregroundStyle(Color(.Other.cell))
                }
        }
    }
}


struct EtcCellView: View {
    @StateObject var btnVM = ButtonViewModel()
    let nextBtnID = UUID()
    let title: String
    let action: VOID_TO_VOID
    
    var body: some View {
        HStack(spacing: 0) {
            Text("\(title)")
                .font(.nps(font: .bold, size: 20))
                .foregroundStyle(Color(.Text.detail))
            Spacer(minLength: 1)
            SimpleBtnView(vm: btnVM, id: nextBtnID)
                .padding([.top,.bottom],24)
        }
        .onAppear {
            btnVM.setSize(for: nextBtnID, newWidth: 24, newHeight: 24)
            btnVM.setImage(for: nextBtnID, newImage: Image(.Icon.right))
            btnVM.setAction(for: nextBtnID, newAction: action)
        }
    }
}

struct DashedDivider: View {
    var body: some View {
        Rectangle()
            .stroke(style: StrokeStyle(lineWidth: 1, dash: [5, 3]))
            .foregroundColor(Color.Disable.normal)
            .frame(height: 1)
    }
}
