//
//  Parameter.swift
//  RememberbyAnything
//
//  Created by Sean Kim on 4/26/24.
//

import SwiftUI

//MARK: - Alert 관련 데이터 정의

enum AlertType {
    case sign
}

struct AlertData {
    var title: String
    var body: String
    var button: [ButtonType]
    
    init(title: String = "알림", body: String, button: [ButtonType] = [.init(name: "확인", role: .none, function: nil)]) {
        self.title = title
        self.body = body
        self.button = button
    }
}

struct ButtonType {
    var name: String
    var role: ButtonRole?
    var function: (()->())?
}

// MARK: - API ERROR
struct API_ERROR:Error {
    var caseType: CASE
    var message: String
    
    enum CASE: Error{
        case API_PLIST_WRONG
        case API_PATH_WRONG
        case API_CONNECT
        case API_READ
    }
}

struct LOGIN_ERROR: Error {
    var caseType: CASE
    var message: String
    
    enum CASE: Error {
        case KAKAO_LOGIN
        case KAKAO_ACC_USER
        case APPLE_LOGIN
    }
}

//MARK: - FB_CRUD 데이터 정의
struct FB_ERROR:Error {
    var caseType: CASE
    var message: String
    
    enum CASE: Error{
        case FB_CREATE_PARSING
        case FB_CREATE_SAVING
        case FB_UPDATE_DOC_READ
        case FB_UPDATE_TRY
        case FB_READ_PARSING
        case FB_READ_PATH
        case FB_READ_EXIST
        case FB_DELETE_TRY
        case FB_PATH_WRONG
    }
    
}

//MARK: - 유저 관련 데이터 정의
enum Role: String {
    case Admin = "A"
    case Tester = "T"
    
    case Master = "M"
    case Employee = "E"
}

struct userData {
    var name: String
    var code: String
    var company: String
    var role: Role
    var noReadAlert: [String]
    var readAlert: [String]
    
    init(name: String, code: String, company: String, role: Role, noReadAlert: [String], readAlert: [String]) {
        self.name = name
        self.code = code
        self.company = company
        self.role = role
        self.noReadAlert = noReadAlert
        self.readAlert = readAlert
    }
}
