package cn.muchinfo.rma.global.data.futureOrders

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

/***成交单实体 */
data class DealOrderData(
    val accountid: String? = "",//账户ID
    val buyorsell: String? = "",//买卖 - 0:买 1:卖
    val channelbuildtype: String? = "",//开平标志 - 0:无 1:建仓 2:平仓
    val channelinnerorderstatus: String? = "",//委托状态 - 1:委托请求 2:冻结成功 3:委托失败 4:委托部成部失败 5:委托成功 6:全部撤销 7:部成部撤 8:部成部撤部失败 9:全部成交
    val channeloperatetype: String? = "",//操作类型 - 1:正常委托 2:斩仓委托 3:强平委托
    val closetype: String? = "",//平仓方式 - 0:无 1:平今 2:平昨
    val curexchangerate: String? = "",//当前汇率
    val exchangefullname: String? = "",//外部交易所全称
    val goodscode: String? = "",//商品代码(内部)
    val goodsid: String? = "",//商品ID
    val goodsname: String? = "",//商品名称
    val marketid: String? = "",//市场ID
    val openfreezemargin: String? = "",//冻结保证金(冻结交易金额)

    val orderid: String? = "",//委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
    val orderprice: String? = "",//委托价格(账户)
    val orderqty: String? = "",//委托数量
    val ordertime: String? = "",//委托时间
    val pricemode: String? = "",//取价方式 - 1:市价 2: 限价
    val tradedate: String? = "",//交易日(yyyyMMdd)
    val tradeqty: String? = "",//成交数量
    val tradetime: String? = "",//成交时间
    val tradeprice: String? = "",//成交价格
    var select: Boolean = false
) : 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(),
        parcel.readString(),
        parcel.readByte() != 0.toByte()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(accountid)
        parcel.writeString(buyorsell)
        parcel.writeString(channelbuildtype)
        parcel.writeString(channelinnerorderstatus)
        parcel.writeString(channeloperatetype)
        parcel.writeString(closetype)
        parcel.writeString(curexchangerate)
        parcel.writeString(exchangefullname)
        parcel.writeString(goodscode)
        parcel.writeString(goodsid)
        parcel.writeString(goodsname)
        parcel.writeString(marketid)
        parcel.writeString(openfreezemargin)
        parcel.writeString(orderid)
        parcel.writeString(orderprice)
        parcel.writeString(orderqty)
        parcel.writeString(ordertime)
        parcel.writeString(pricemode)
        parcel.writeString(tradedate)
        parcel.writeString(tradeqty)
        parcel.writeString(tradetime)
        parcel.writeString(tradeprice)
        parcel.writeByte(if (select) 1 else 0)
    }

    override fun describeContents(): Int {
        return 0
    }

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

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

}