//
//  ProfileReportMenuView.swift
//  SodaLive
//
//  Created by klaus on 2023/08/11.
//

import SwiftUI

struct ProfileReportMenuView: View {
    
    @Binding var isShowing: Bool
    
    let isBlockedUser: Bool
    let userBlockAction: () -> Void
    let userUnBlockAction: () -> Void
    let userReportAction: () -> Void
    let profileReportAction: () -> Void
    
    var body: some View {
        ZStack {
            Color.black
                .opacity(0.7)
                .ignoresSafeArea()
                .onTapGesture { isShowing = false }
            
            VStack(spacing: 0) {
                Spacer()
                
                VStack(spacing: 13.3) {
                    HStack(spacing: 0) {
                        Text(isBlockedUser ? "사용자 차단해제" : "사용자 차단하기")
                            .font(.custom(Font.medium.rawValue, size: 13.3))
                            .foregroundColor(.white)
                        
                        Spacer()
                    }
                    .padding(.vertical, 8)
                    .padding(.horizontal, 26.7)
                    .contentShape(Rectangle())
                    .onTapGesture {
                        isShowing = false
                        if isBlockedUser {
                            userUnBlockAction()
                        } else {
                            userBlockAction()
                        }
                    }
                    
                    HStack(spacing: 0) {
                        Text("사용자 신고하기")
                            .font(.custom(Font.medium.rawValue, size: 13.3))
                            .foregroundColor(.white)
                        
                        Spacer()
                    }
                    .padding(.vertical, 8)
                    .padding(.horizontal, 26.7)
                    .contentShape(Rectangle())
                    .onTapGesture {
                        isShowing = false
                        userReportAction()
                    }
                    
                    HStack(spacing: 0) {
                        Text("프로필 신고하기")
                            .font(.custom(Font.medium.rawValue, size: 13.3))
                            .foregroundColor(.white)
                        
                        Spacer()
                    }
                    .padding(.vertical, 8)
                    .padding(.horizontal, 26.7)
                    .contentShape(Rectangle())
                    .onTapGesture {
                        isShowing = false
                        profileReportAction()
                    }
                }
                .padding(24)
                .background(Color(hex: "222222"))
                .cornerRadius(13.3, corners: [.topLeft, .topRight])
            }
        }
    }
}