//
//  YHConsortInfo.swift
//  galaxy
//
//  Created by edy on 2024/1/23.
//  Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//

import UIKit

class YHConsortInfo {
    
}

public enum YHTableItemType : Int32 {
    
    // 是否随行
    case accompany = 0
    // 国籍
    case country = 1
    // 居住信息
    case address = 2
    // 港澳通信证
    case hongkongMacaouPassport = 3
}


//表单条目信息
class YHTableItemInfo {
   
    var type:YHTableItemType
    var title:String {
        return getTitle()
    }
    
    init(type: YHTableItemType) {
        self.type = type
    }
    
    var subTitleItems:[YHTableSubItemInfo]? = Array()
    
    func getTitle()-> String {
        switch self.type {
        case .accompany:
                return "随行".local
            case .country:
                return "国籍".local
            case .address:
                return "居住信息".local
            case .hongkongMacaouPassport:
                return "港澳通信证".local
        }
    }
    
    func getSubItems()->[YHTableSubItemInfo] {
        
        let item0 = YHTableSubItemInfo(type: .subTitle)
        var res = [item0]
        
        switch self.type {
            case .accompany:
               res.append(YHTableSubItemInfo(type: .subAcompany))
            
            case .country:
               res.append(YHTableSubItemInfo(type: .subCountry))
            
            case .address:
                let item1 = YHTableSubItemInfo(type: .subIsLiveTogether, isMust: true)
                let item2 = YHTableSubItemInfo(type: .subLiveNation, isMust: true)
                let item3 = YHTableSubItemInfo(type: .subDetailAddress, isMust: true)
                res.append(contentsOf:[item1, item2, item3])
                           
            case .hongkongMacaouPassport:
                res.append(YHTableSubItemInfo(type: .subHongkongMacaouPassport, isMust: true))
        }
        return res
    }
}

public enum YHTableSubItemType : Int32 {
    
    // 标题
    case subTitle = 0
    // 是否随行
    case subAcompany = 1
    // 国籍
    case subCountry = 2
    
    /*    居住信息   */
    // 是否与主申请人同住
    case subIsLiveTogether = 3
    // 居住国家/地区
    case subLiveNation = 4
    // 现居住城市
    case subLiveCity = 5
    // 详细地址
    case subDetailAddress = 6
    
    // 港澳通信证
    case subHongkongMacaouPassport = 7
    
}


class YHTableSubItemInfo {
    
    var type:YHTableSubItemType
    // 是否必填
    var isMust:Bool
    
    
    
    var title:String {
        return getTitle()
    }
    
    init(type: YHTableSubItemType, isMust:Bool = true) {
        self.type = type
        self.isMust = isMust
    }
    
    func getTitle()-> String {
        
        switch self.type {
            case .subTitle:
                return "".local
            case .subAcompany:
                return "是否随行至香港".local
            case .subCountry:
                return "国家/地区".local
            case .subIsLiveTogether:
                return "是否与主申请人同住".local
            case .subLiveNation:
                return "国家/地区".local
            case .subLiveCity:
                return "现居住城市".local
            case .subDetailAddress:
                return "现居住地址".local
            case .subHongkongMacaouPassport:
                return "是否办理".local
        }
    }
}
