//
//  ApplyMethodView.swift
//  SodaLive
//
//  Created by klaus on 1/7/25.
//

import SwiftUI

struct ApplyMethodView: View {
    
    @Binding var isShowing: Bool
    
    let onClickSelectAudioFile: () -> Void
    let onClickRecording: () -> Void
    
    var body: some View {
        ZStack {
            Color.black.opacity(0.7).ignoresSafeArea()
                .onTapGesture {
                    isShowing = false
                }
            
            VStack(spacing: 0) {
                HStack(spacing: 0) {
                    Spacer()
                    Image("ic_noti_stop")
                        .onTapGesture {
                            isShowing = false
                        }
                }
                
                Text("오디션 지원방식")
                    .font(.custom(Font.bold.rawValue, size: 18.3))
                    .foregroundColor(Color.graybb)
                    .padding(.top, 33.3)
                
                HStack(spacing: 13.3) {
                    HStack(spacing: 3) {
                        Image("ic_upload")
                        
                        Text("파일 업로드")
                            .font(.custom(Font.medium.rawValue, size: 14.7))
                            .foregroundColor(Color.button)
                    }
                    .padding(.vertical, 8)
                    .frame(maxWidth: .infinity)
                    .background(Color.bg)
                    .cornerRadius(5.3)
                    .overlay(
                        RoundedRectangle(cornerRadius: 8)
                            .stroke()
                            .foregroundColor(Color.button)
                    )
                    .contentShape(Rectangle())
                    .onTapGesture {
                        onClickSelectAudioFile()
                    }
                    
                    HStack(spacing: 3) {
                        Image("ic_mic_color_button")
                        
                        Text("바로 녹음")
                            .font(.custom(Font.medium.rawValue, size: 14.7))
                            .foregroundColor(Color.button)
                    }
                    .padding(.vertical, 8)
                    .frame(maxWidth: .infinity)
                    .background(Color.bg)
                    .cornerRadius(5.3)
                    .overlay(
                        RoundedRectangle(cornerRadius: 8)
                            .stroke()
                            .foregroundColor(Color.button)
                    )
                    .contentShape(Rectangle())
                    .onTapGesture {
                        onClickRecording()
                    }
                }
                .padding(.top, 21.3)
                
                HStack(spacing: 0) {
                    Text("※ 파일은 mp3, aac만 업로드 가능")
                        .font(.custom(Font.medium.rawValue, size: 12))
                        .foregroundColor(Color.gray77)
                        .padding(.top, 13.3)
                    
                    Spacer()
                }
            }
            .padding(.horizontal, 16.7)
            .padding(.vertical, 13.3)
            .frame(maxWidth: .infinity)
            .background(Color.gray22)
            .cornerRadius(10.3)
            .padding(.horizontal, 13.3)
        }
    }
}

#Preview {
    ApplyMethodView(
        isShowing: .constant(true),
        onClickSelectAudioFile: {},
        onClickRecording: {}
    )
}
