package com.lukouguoji.module_base.bean

import com.lukouguoji.module_base.ktx.noNull

/**
 * 平板车或集装器 数据类
 */
class GbCarOrUldBean(
    var `data`: Data? = Data(),
    var type: String? = ""
) {

    class Data(
        var carid: String? = "",
        var carweight: String? = "",
        var gjcLoading: List<GjcLoading?>? = listOf(),
        var locId: String? = "",
        var totalWeight: String? = "",
        var organizationCode: String? = "",
        var uld: String? = "",
        var uldWeight: String? = "",
        var maxWeight: String? = "",
        var maxVolume: String? = "",
        var uldType: String? = "",
        var uldFlag: String? = "",
        var carrier: String? = "",
        var airport: String? = "",
    ) {

        fun getGjcLoadingBean(): GjcLoading {
            return gjcLoading?.firstOrNull() ?: GjcLoading()
        }

        fun createForMerge(bean: Data): Data {
            val data = Data()
            data.carid = bean.carid.noNull(carid.noNull())
            data.carweight = bean.carweight.noNull(carweight.noNull())
            if (bean.gjcLoading != null) {
                data.gjcLoading = bean.gjcLoading
            }
            data.locId = bean.locId.noNull(locId.noNull())
            data.totalWeight = bean.totalWeight.noNull(totalWeight.noNull())
            data.organizationCode = bean.organizationCode.noNull(organizationCode.noNull())
            data.uld = bean.uld.noNull(uld.noNull())
            data.uldWeight = bean.uldWeight.noNull(uldWeight.noNull())
            data.maxWeight = bean.maxWeight.noNull(maxWeight.noNull())
            data.maxVolume = bean.maxVolume.noNull(maxVolume.noNull())
            data.uldType = bean.uldType.noNull(uldType.noNull())
            data.uldFlag = bean.uldFlag.noNull(uldFlag.noNull())
            data.carrier = bean.carrier.noNull(carrier.noNull())
            data.airport = bean.airport.noNull(airport.noNull())
            return data
        }
    }

    class GjcLoading(
        var agentCode: Any? = Any(),
        var boardtype: String? = "",
        var cargotype: String? = "",
        var cargoName: String? = "",
        var cargoweight: String? = "",
        var carid: String? = "",
        var carrier: String? = "",
        var cflag: String? = "",
        var dest: String? = "",
        var emptyuld: String? = "",
        var fclose: String? = "",
        var fdate: String? = "",
        var fid: String? = "",
        var fno: String? = "",
        var locId: String? = "",
        var location: String? = "",
        var mailpc: String? = "",
        var mailvolume: String? = "",
        var mailweight: String? = "",
        var mawbNo: Any? = Any(),
        var maxvolume: String? = "",
        var maxweight: String? = "",
        var movID: Any? = Any(),
        var netweight: String? = "",
        var no: Any? = Any(),
        var opdate: String? = "",
        var opid: String? = "",
        var opname: String? = "",
        var organizationcode: String? = "",
        var pc: String? = "",
        var prefix: Any? = Any(),
        var priority: String? = "",
        var remark: String? = "",
        var reviewDate: Any? = Any(),
        var reviewWeight: Any? = Any(),
        var reviewer: Any? = Any(),
        var spCode: Any? = Any(),
        var uld: String? = "",
        var uldflag: String? = "",
        var uldweight: String? = "",
        var volume: String? = ""
    )

}