//
//  YHMainApplicantInfoViewController.swift
//  galaxy
//
//  Created by davidhuangA on 2024/1/29.
//  Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//

import UIKit
import JXSegmentedView
/*
 *主申请人信息
 */
class YHMainApplicantInfoViewController: YHPersonInfoBaseViewController {
    var arrData : [YHPersonInfoCellModel] = []
    override func viewDidLoad() {
        super.viewDidLoad()
        setupUI()
    }
    
    
}

private extension YHMainApplicantInfoViewController {
    func fakeData() {
        do {
            //国家信息
            let tmp0 = YHPersonInfoBaseModel(name: "国家/国籍：", description: "中国-China")
            let tmp1 = YHPersonInfoBaseModel(name: "港澳通行证：", description: "未办理")
            let arr = [tmp0,tmp1]
            let model1 = YHPersonInfoCellModel(cellType: 0, cellTitle: "国籍信息", cellData0: arr)
            arrData.append(model1)
        }
        
        do {
            //基本信息
            let tmp0 = YHPersonInfoBaseModel(name: "主申请人：", description: "DavidHuang")
            let tmp1 = YHPersonInfoBaseModel(name: "曾用名：", description: "--")
            let tmp2 = YHPersonInfoBaseModel(name: "婚前姓氏：", description: "--")
            
            let tmp3 = YHPersonInfoBaseModel(name: "出生日期：", description: "1990年8月18日")
            let tmp4 = YHPersonInfoBaseModel(name: "出生城市：", description: "国内 吉林省/吉林市")
            let tmp5 = YHPersonInfoBaseModel(name: "性别：", description: "男")
            let tmp6 = YHPersonInfoBaseModel(name: "婚姻状况：", description: "已婚")
            let tmp7 = YHPersonInfoBaseModel(name: "手机号：", description: "13572984488")
            let tmp8 = YHPersonInfoBaseModel(name: "邮箱：", description: "13572984488@nn.com")
            let tmp9 = YHPersonInfoBaseModel(name: "现居住地址：", description: "现居住地址：现居住地址：现居住地址：现居住地址：现居住地址：现居住地址：")
            
            let tmp10 = YHPersonInfoBaseModel(name: "详细地址：", description: "锐度公园世家北区10-1-701锐度公园世家北区10-1-701")
            let tmp11 = YHPersonInfoBaseModel(name: "是否办理过香港身份证：", description: "是")
            let tmp12 = YHPersonInfoBaseModel(name: "香港身份证：", description: "否")
            
            let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9,tmp10,tmp11,tmp12]
            let model2 = YHPersonInfoCellModel(cellType: 0, cellTitle: "基本信息", cellData0: arr)
            arrData.append(model2)
        }
        
        
        do {
            //证件信息
            let tmp0 = YHPersonInfoBaseModel(name: "中国身份证号码：", description: "2203381990287633390")
            let tmp1 = YHPersonInfoBaseModel(name: "签发地：", description: "北京市分局")
            let tmp2 = YHPersonInfoBaseModel(name: "签发日期：", description: "2018-07-17")
            let tmp3 = YHPersonInfoBaseModel(name: "届满日期：", description: "2028-07-31")
            let model0 = YHPersonInfoCellModel1(cellTitle: "中国身份证", cellData: [tmp0,tmp1,tmp2,tmp3])
            
            
            let tmp4 = YHPersonInfoBaseModel(name: "旅行社证件号码：", description: "c2345639")
            let tmp5 = YHPersonInfoBaseModel(name: "签发地：", description: "北京市分局")
            let tmp6 = YHPersonInfoBaseModel(name: "签发日期：", description: "2018-07-17")
            let tmp7 = YHPersonInfoBaseModel(name: "届满日期：", description: "2028-07-31")
            let model1 = YHPersonInfoCellModel1(cellTitle: "港澳通行证", cellData: [tmp4,tmp5,tmp6,tmp7])
            
            
            let tmp8 = YHPersonInfoBaseModel(name: "证件类别：", description: "护照")
            let tmp9 = YHPersonInfoBaseModel(name: "证件号码：", description: "p2345639")
            let tmp10 = YHPersonInfoBaseModel(name: "签发地：", description: "北京市分局")
            let tmp11 = YHPersonInfoBaseModel(name: "签发日期：", description: "2028-07-31")
            let tmp12 = YHPersonInfoBaseModel(name: "届满日期：", description: "2028-07-31")
            let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
            
            let arr = [model0,model1,model2]
            let model3 = YHPersonInfoCellModel(cellType: 1, cellTitle: "证件信息", cellData1: arr)
            arrData.append(model3)
        }
        
        
        do {
            //证件照片
            let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: "", backUrl: "", idType: 1)
            let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: "", backUrl: "", idType: 2)
            
            let arr = [model1,model2]
            let model4 = YHPersonInfoCellModel(cellType: 2, cellTitle: "证件照片", cellData2: arr)
            arrData.append(model4)
        }
    }
    
    func setupUI() {
        fakeData()
        self.homeTableView.register(YHPersonInfoCommonCell.self,forCellReuseIdentifier: YHPersonInfoCommonCell.cellReuseIdentifier)
        self.homeTableView.reloadData()
    }
}



// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHMainApplicantInfoViewController {
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return arrData.count
    }
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withClass: YHPersonInfoCommonCell.self)
        cell.model = arrData[indexPath.row]
        return cell
    }
}
