//
//  YHDatePickView.swift
//  galaxy
//
//  Created by EDY on 2024/1/30.
//  Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//

import Foundation

struct YHCountryModel {
    var provincesArray: [YHProvincesModel] = []
    init(dic: [String:[String:[String]]]) {
        for (key,value) in dic {
            let model = YHProvincesModel(name: key, dic: value)
            provincesArray.append(model)
            provincesArray.sort { a, b in
                a.provincesName < b.provincesName
            }
        }
    }
}

struct YHProvincesModel {
    var provincesName: String = ""
    var cityArray: [YHCityModel] = []
    init(name : String ,dic:[String: [String]]) {
        provincesName = name
        for (key,value) in dic {
            let model = YHCityModel(name: key, Arr: value)
            cityArray.append(model)
            cityArray.sort { a, b in
                a.cityName < b.cityName
            }
        }
    }
}

struct YHCityModel {
    var cityName: String = ""
    var areaArray: [String] = []
    init(name: String,Arr: [String]) {
        cityName = name
        for str in Arr {
            areaArray.append(str)
        }
        areaArray.sort(by: <)
    }
}
