package cn.muchinfo.rma.global.data

import android.os.Parcel
import android.os.Parcelable

/**
 * 敞口现货明细/敞口现货头寸(
 * @property areauserid String? 机构ID
 * @property changeQty String? 套保变动量
 * @property contracttype String? 现货合同类型 - 1:采购 -1:销售
 * @property convertfactor String? 标仓系数
 * @property convertratio String? 套保系数
 * @property createtime String? 时间
 * @property enumdicname String? 现货商品单位名称
 * @property logtype String? 类型 - 1:套保计划 2:现货合同
 * @property middlegoodsId String? 套保商品id
 * @property middlegoodscode String? 套保商品代码
 * @property middlegoodsname String? 套保商品名称
 * @property qty String? 数量
 * @property relateNo String? 现货合同/套保计划编号
 * @property wrstandardcode String? 现货商品代码
 * @property wrstandardid String? 现货商品ID
 * @property wrstandardname String 现货商品名称
 * @constructor
 */
data class ExposureDetailData(
    val areauserid : String?,
    val changeQty : String?,
    val contracttype : String?,
    val convertfactor : String?,
    val convertratio : String?,
    val createtime  : String?,
    val enumdicname : String?,
    val logtype : String?,
    val middlegoodsId : String?,
    val middlegoodscode : String?,
    val middlegoodsname : String?,
    val qty : String?,
    val relateNo : String?,
    val wrstandardcode : String?,
    val wrstandardid : String?,
    val wrstandardname : String?,
    val decreaseqty : String?,//减少数量=-(销售已定价数量+采购计划数量)
    val increaseqty : String?,//增加数量=销售计划数量+采购已定价数量
    val oritoalspotqty : String?,//昨日数量
    val totalspotqty : String?,//当前数量(现货头寸总量) = (销售计划数量 - 销售已定价数量) - (采购计划数量 - 采购已定价数量)
    val updatetime : String?//更新时间
) : Parcelable{
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(areauserid)
        parcel.writeString(changeQty)
        parcel.writeString(contracttype)
        parcel.writeString(convertfactor)
        parcel.writeString(convertratio)
        parcel.writeString(createtime)
        parcel.writeString(enumdicname)
        parcel.writeString(logtype)
        parcel.writeString(middlegoodsId)
        parcel.writeString(middlegoodscode)
        parcel.writeString(middlegoodsname)
        parcel.writeString(qty)
        parcel.writeString(relateNo)
        parcel.writeString(wrstandardcode)
        parcel.writeString(wrstandardid)
        parcel.writeString(wrstandardname)
        parcel.writeString(decreaseqty)
        parcel.writeString(increaseqty)
        parcel.writeString(oritoalspotqty)
        parcel.writeString(totalspotqty)
        parcel.writeString(updatetime)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<ExposureDetailData> {
        override fun createFromParcel(parcel: Parcel): ExposureDetailData {
            return ExposureDetailData(parcel)
        }

        override fun newArray(size: Int): Array<ExposureDetailData?> {
            return arrayOfNulls(size)
        }
    }

}