//
//  YHEducationInfo.swift
//  galaxy
//
//  Created by edy on 2024/2/20.
//  Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//

import UIKit
import SmartCodable

class YHEducationListInfo: SmartCodable {
    var eduList: [YHEducationInfo]?
    var eduCount: Int = 0
    var quaList: [YHQualificationInfo]?
    var quaCount: Int = 0
    var qualification: Int = 0
    var graduate: Int = 0
    var married: Int = 0

    enum CodingKeys: String, CodingKey {
        case eduList = "edu_list"
        case eduCount = "edu_count"
        case quaList = "qua_list"
        case quaCount = "qua_count"
        case qualification = "qualification"
        case graduate = "graduate"
        case married = "married"
    }

    required init() {
        
    }
}

class YHEducationInfo: SmartCodable {
    var id: Int = -1
    var orderId: Int = -1
    var college: String?
    var background: String?
    var professional: String?
    var admissionTime: String?
    var graduateTime: String?
    var vacantNum: Int = 0

    enum CodingKeys: String, CodingKey {
        case id = "id"
        case orderId = "order_id"
        case college = "college"
        case background = "background"
        case professional = "professional"
        case admissionTime = "admission_time"
        case graduateTime = "graduate_time"
        case vacantNum = "vacant_num"
    }
    
    required init() {
        
    }
}

class YHQualificationInfo: SmartCodable {
    var id: Int = -1
    var orderId: Int = -1
    var qualification: String?
    var vacantNum: Int = 0

    enum CodingKeys: String, CodingKey {
        case id = "id"
        case orderId = "order_id"
        case qualification = "qualification"
        case vacantNum = "vacant_num"
    }

    required init() {
        
    }
}


class YHEducationDetailInfo: SmartCodable {
    
    var id: Int = 0
    var orderId: Int = 0
    var college: String?
    var isTop: Int = 0
    var type: String?
    var admissionTime: String?
    var graduateTime: String?
    var background: String?
    var professional: String?
    var degreeType: String?
    var remark: String?
    var average: String?
    var schoolAddress: YHSchoolAddress?
    var schoolAddressAboard: Int = 0
    var oldId: Int = 0
    var createdAt: String?
    var updatedAt: String?
    var deletedAt: SmartAny?
    var isShow: Int = 0
    var operatorName: SmartAny?
    var operatorEnglishName: SmartAny?
    var operatorId: Int = 0
    var matchListing: Int = 0
    var createFromAppid: Int = 0
    var updateFromAppid: Int = 0
    var customerCenterId: Int = 0
    
    enum CodingKeys: String, CodingKey {
        case id = "id"
        case orderId = "order_id"
        case college = "college"
        case isTop = "is_top"
        case type = "type"
        case admissionTime = "admission_time"
        case graduateTime = "graduate_time"
        case background = "background"
        case professional = "professional"
        case degreeType = "degree_type"
        case remark = "remark"
        case average = "average"
        case schoolAddress = "school_address"
        case schoolAddressAboard = "school_address_aboard"
        case oldId = "old_id"
        case createdAt = "created_at"
        case updatedAt = "updated_at"
        case deletedAt = "deleted_at"
        case isShow = "is_show"
        case operatorName = "operator_name"
        case operatorEnglishName = "operator_english_name"
        case operatorId = "operator_id"
        case matchListing = "match_listing"
        case createFromAppid = "create_from_appid"
        case updateFromAppid = "update_from_appid"
        case customerCenterId = "customer_center_id"
    }
    
    required init() {
        
    }
    // 学校是否在国外 默认是在国内
    func isSchoolInAboard() -> Bool {
        guard let schoolAddress = schoolAddress else { return false }
        guard let country = schoolAddress.country else { return false }
        if country.contains("中国") {
            return false
        }
        return true
    }
}

class YHSchoolAddress: Codable {
    var area: [String]?
    var country: String?
    var foreign: String?

    enum CodingKeys: String, CodingKey {
        case area = "area"
        case country = "country"
        case foreign = "foreign"
    }

    required init(area: [String]?, country: String?, foreign: String?) {
        self.area = area
        self.country = country
        self.foreign = foreign
    }
}

