package com.lukouguoji.module_base.bean

import androidx.databinding.BaseObservable
import androidx.databinding.Bindable
import androidx.databinding.ObservableBoolean
import com.lukouguoji.module_base.BR
import com.lukouguoji.module_base.interfaces.ICheck

class GnjManifestBean : BaseObservable(), ICheck {

    // 是否有效
    @Bindable
    var activeId: String = "" // 0
        set(value) {
            field = value
            notifyPropertyChanged(BR.activeId)
        }

    // 代理人代码
    @Bindable
    var agentCode: String = "" // LH
        set(value) {
            field = value
            notifyPropertyChanged(BR.agentCode)
        }

    // 提运单类型
    @Bindable
    var awbType: String = "" // 国内进港
        set(value) {
            field = value
            notifyPropertyChanged(BR.awbType)
        }

    // 业务类型
    @Bindable
    var businessType: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.businessType)
        }

    // 货物类型代码
    @Bindable
    var cargoType: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.cargoType)
        }
    var cashWeight: String = "" // 3

    // 收货人代码
    @Bindable
    var cneeCode: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.cneeCode)
        }

    // 收货人身份证
    @Bindable
    var cneeId: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.cneeId)
        }

    // 收货人电话
    @Bindable
    var cneeTel: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.cneeTel)
        }

    // 确认日期
    @Bindable
    var confirmDate: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.confirmDate)
        }

    // 确认人ID
    @Bindable
    var confirmId: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.confirmId)
        }

    // 收货人
    @Bindable
    var consignee: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.consignee)
        }

    // 目的港-货物
    @Bindable
    var dest: String = "" // HFE
        set(value) {
            field = value
            notifyPropertyChanged(BR.dest)
        }

    // 危险品描述
    @Bindable
    var dgrDetail: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.dgrDetail)
        }

    // 危险品库
    @Bindable
    var dgrLocation: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.dgrLocation)
        }
    var efNo: String = "" // null

    @Bindable
    var fdep: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.fdep)
        }

    @Bindable
    var fdest: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.fdest)
        }

    // 航班流水号
    @Bindable
    var fid: String = "" // 264750
        set(value) {
            field = value
            notifyPropertyChanged(BR.fid)
        }

    // 货物品名
    @Bindable
    var goods: String = "" // 测试
        set(value) {
            field = value
            notifyPropertyChanged(BR.goods)
        }

    // 货位类型(0:散仓;1:ULD)
    @Bindable
    var locFlag: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.locFlag)
        }

    //
    var locFlagMft: String = "" // null

    // 货物货位
    @Bindable
    var location: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.location)
        }
    var locationMft: String = "" // null

    // 流水号
    // 主键ID
    @Bindable
    var mfId: String = ""  // 996281
        set(value) {
            field = value
            notifyPropertyChanged(BR.mfId)
        }

    // 主提运单号
    @Bindable
    var no: String = "" // 22222782
        set(value) {
            field = value
            notifyPropertyChanged(BR.no)
        }
    var opDate: String = "" // null
    var opId: String = "" // null

    // 始发港-货物
    @Bindable
    var origin: String = "" // PEK
        set(value) {
            field = value
            notifyPropertyChanged(BR.origin)
        }

    // 包装类型代码
    @Bindable
    var packageType: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.packageType)
        }

    // 实到件数
    @Bindable
    var pc: String = "" // 5
        set(value) {
            field = value
            notifyPropertyChanged(BR.pc)
        }

    // 主提运单前缀(承运人运单三字码)
    @Bindable
    var prefix: String = "" // 781
        set(value) {
            field = value
            notifyPropertyChanged(BR.prefix)
        }

    // 舱单发放标识(0:未发放;1:已发放)
    @Bindable
    var ref: String = "" // 0
        set(value) {
            field = value
            notifyPropertyChanged(BR.ref)
        }
    var refDate: String = "" // null

    // 运单备注信息
    @Bindable
    var remark: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.remark)
        }

    // 特种货物代码
    @Bindable
    var spCode: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.spCode)
        }

    // 分批标识
    @Bindable
    var splitFlag: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.splitFlag)
        }

    // 特种货物子代码
    @Bindable
    var subCode: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.subCode)
        }

    // 提运单总件数
    @Bindable
    var totalPc: String = "" // 5
        set(value) {
            field = value
            notifyPropertyChanged(BR.totalPc)
        }
    var tranDate: String = "" // null

    // Un编号
    @Bindable
    var unNumber: String = "" // null
        set(value) {
            field = value
            notifyPropertyChanged(BR.unNumber)
        }

    // 实到体积
    @Bindable
    var volume: Double = 0.0 // 0.01
        set(value) {
            field = value
            notifyPropertyChanged(BR.volume)
        }

    // 主运单号
    @Bindable
    var wbNo: String = "" // 78122222782
        set(value) {
            field = value
            notifyPropertyChanged(BR.wbNo)
        }
        get() {
            if (field.isEmpty()) {
                field = "$prefix$no"
            }
            return field
        }

    // 实到重量
    @Bindable
    var weight: String = "" // 3

    val checked = ObservableBoolean(false)

    override fun getCheckObservable() = checked

}