package cn.muchinfo.rma.global.data;

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

import cn.muchinfo.rma.global.HashTools;


public class PresellListingData implements Parcelable {


    /**
     * listingid : 1501532965695020001
     * applyid : 3
     * tradedate : 20180729
     * selleraccountid : 250000000007
     * marketid : 23201
     * goodsname : 0729预售03
     * goodscode : #P000003
     * unit : 克
     * applyqty : 100
     * steppricetype : 1
     * goodsdesc : 0729预售03
     * <p>
     * 0729预售03
     * <p>
     * 0729预售03
     * goodspicurl : ./uploadFile/20180730/201807301545034694.jpg
     * decimalplace : 0
     * sellmarginalgorithm : 1
     * sellmarginvalue : 0.01
     * buychargealgorithm : 1
     * buychargevalue : 0.0004
     * sellchargealgorithm : 1
     * sellchargevalue : 0.0003
     * performancemode : 2
     * performancetemplateid : 2
     * presalestatus : 1
     * handlestatus : 0
     * createtime : 2018-07-30 15:48:15.0
     * updatetime : 2018-07-30 16:05:07.0
     * startday : 20180730
     * endday : 20180730
     * sellerfreezemargin : 0
     * sellerfreezecharge : 0
     * templatename : 预售冻结配送
     * trademode : 23
     * price : 0
     */

    private String listingid;  //预售挂牌ID
    private String applyid;  //预售申请ID
    private String tradedate;  //交易日
    private String selleraccountid;  //卖方资金账号ID
    private String marketid;   //市场ID
    private String goodsname;  //商品名称
    private String goodscode;  //商品代码
    private String unit;       //单位
    private String applyqty;   //申请数量
    private String steppricetype;  //阶梯价类型
    private String goodsdesc;      //商品详情
    private String goodspicurl;    //商品介绍图片
    private String decimalplace;   //价格小数位
    private String sellmarginalgorithm;  //卖方保证金收取方式
    private String sellmarginvalue;  //卖方保证金设置值
    private String buychargealgorithm;  //买方手续费收取方式
    private String buychargevalue;     //买方手续费设置值
    private String sellchargealgorithm;   //卖方手续费收取方式
    private String sellchargevalue;  //卖方手续费设置值
    private String performancemode;    //履约方式
    private String performancetemplateid;  //履约计划模板ID
    private String presalestatus; //预售状态 1：预售中 2：未开始 3：预售成功 4：预售失败 5：处理失败
    private String handlestatus; //处理状态
    private String createtime;//创建时间
    private String updatetime; //更新时间
    private String startday;//开始时间
    private String endday;//结束时间
    private String sellerfreezemargin;//卖方冻结保证金
    private String sellerfreezecharge;//卖方冻结手续费
    private String templatename;//履约模板名称
    private String trademode;//交易模式
    private String price = "null"; //当前价格
    private String goodsid;  //商品id
    private String mintradeqty;  //最小摘牌数量
    private String tradeqty;
    private String totaltradeamount; //成交总金额

    public PresellListingData(){

    }


    protected PresellListingData(Parcel in) {
        listingid = in.readString();
        applyid = in.readString();
        tradedate = in.readString();
        selleraccountid = in.readString();
        marketid = in.readString();
        goodsname = in.readString();
        goodscode = in.readString();
        unit = in.readString();
        applyqty = in.readString();
        steppricetype = in.readString();
        goodsdesc = in.readString();
        goodspicurl = in.readString();
        decimalplace = in.readString();
        sellmarginalgorithm = in.readString();
        sellmarginvalue = in.readString();
        buychargealgorithm = in.readString();
        buychargevalue = in.readString();
        sellchargealgorithm = in.readString();
        sellchargevalue = in.readString();
        performancemode = in.readString();
        performancetemplateid = in.readString();
        presalestatus = in.readString();
        handlestatus = in.readString();
        createtime = in.readString();
        updatetime = in.readString();
        startday = in.readString();
        endday = in.readString();
        sellerfreezemargin = in.readString();
        sellerfreezecharge = in.readString();
        templatename = in.readString();
        trademode = in.readString();
        price = in.readString();
        goodsid = in.readString();
        mintradeqty = in.readString();
        tradeqty = in.readString();
        totaltradeamount = in.readString();
    }

    public static final Creator<PresellListingData> CREATOR = new Creator<PresellListingData>() {
        @Override
        public PresellListingData createFromParcel(Parcel in) {
            return new  PresellListingData(in);
        }

        @Override
        public  PresellListingData[] newArray(int size) {
            return new PresellListingData[size];
        }
    };

    public String getListingid() {
        return listingid;
    }

    public void setListingid(String listingid) {
        this.listingid = listingid;
    }

    public String getApplyid() {
        return applyid;
    }

    public void setApplyid(String applyid) {
        this.applyid = applyid;
    }

    public String getTradedate() {
        return tradedate;
    }

    public void setTradedate(String tradedate) {
        this.tradedate = tradedate;
    }

    public String getSelleraccountid() {
        return selleraccountid;
    }

    public void setSelleraccountid(String selleraccountid) {
        this.selleraccountid = selleraccountid;
    }

    public String getMarketid() {
        return marketid;
    }

    public void setMarketid(String marketid) {
        this.marketid = marketid;
    }

    public String getGoodsname() {
        return goodsname;
    }

    public void setGoodsname(String goodsname) {
        this.goodsname = goodsname;
    }

    public String getGoodscode() {
        return goodscode;
    }

    public void setGoodscode(String goodscode) {
        this.goodscode = goodscode;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getApplyqty() {
        return applyqty;
    }

    public void setApplyqty(String applyqty) {
        this.applyqty = applyqty;
    }

    public String getSteppricetype() {
        return steppricetype;
    }

    public void setSteppricetype(String steppricetype) {
        this.steppricetype = steppricetype;
    }

    public String getGoodsdesc() {
        return goodsdesc;
    }

    public void setGoodsdesc(String goodsdesc) {
        this.goodsdesc = goodsdesc;
    }

    public String getGoodspicurl() {
        return goodspicurl;
    }

    public void setGoodspicurl(String goodspicurl) {
        this.goodspicurl = goodspicurl;
    }

    public String getDecimalplace() {
        return decimalplace;
    }

    public void setDecimalplace(String decimalplace) {
        this.decimalplace = decimalplace;
    }

    public String getSellmarginalgorithm() {
        return sellmarginalgorithm;
    }

    public void setSellmarginalgorithm(String sellmarginalgorithm) {
        this.sellmarginalgorithm = sellmarginalgorithm;
    }

    public String getSellmarginvalue() {
        return sellmarginvalue;
    }

    public void setSellmarginvalue(String sellmarginvalue) {
        this.sellmarginvalue = sellmarginvalue;
    }

    public String getBuychargealgorithm() {
        return buychargealgorithm;
    }

    public void setBuychargealgorithm(String buychargealgorithm) {
        this.buychargealgorithm = buychargealgorithm;
    }

    public String getBuychargevalue() {
        return buychargevalue;
    }

    public void setBuychargevalue(String buychargevalue) {
        this.buychargevalue = buychargevalue;
    }

    public String getSellchargealgorithm() {
        return sellchargealgorithm;
    }

    public void setSellchargealgorithm(String sellchargealgorithm) {
        this.sellchargealgorithm = sellchargealgorithm;
    }

    public String getSellchargevalue() {
        return sellchargevalue;
    }

    public void setSellchargevalue(String sellchargevalue) {
        this.sellchargevalue = sellchargevalue;
    }

    public String getPerformancemode() {
        return performancemode;
    }

    public void setPerformancemode(String performancemode) {
        this.performancemode = performancemode;
    }

    public String getPerformancetemplateid() {
        return performancetemplateid;
    }

    public void setPerformancetemplateid(String performancetemplateid) {
        this.performancetemplateid = performancetemplateid;
    }

    public String getPresalestatus() {
        return presalestatus;
    }

    public void setPresalestatus(String presalestatus) {
        this.presalestatus = presalestatus;
    }

    public String getHandlestatus() {
        return handlestatus;
    }

    public void setHandlestatus(String handlestatus) {
        this.handlestatus = handlestatus;
    }

    public String getCreatetime() {
        return createtime;
    }

    public void setCreatetime(String createtime) {
        this.createtime = createtime;
    }

    public String getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(String updatetime) {
        this.updatetime = updatetime;
    }

    public String getStartday() {
        return startday;
    }

    public void setStartday(String startday) {
        this.startday = startday;
    }

    public String getEndday() {
        return endday;
    }

    public String getMintradeqty() {
        return mintradeqty;
    }

    public void setMintradeqty(String mintradeqty) {
        this.mintradeqty = mintradeqty;
    }

    public void setEndday(String endday) {
        this.endday = endday;
    }

    public String getSellerfreezemargin() {
        return sellerfreezemargin;
    }

    public void setSellerfreezemargin(String sellerfreezemargin) {
        this.sellerfreezemargin = sellerfreezemargin;
    }

    public String getSellerfreezecharge() {
        return sellerfreezecharge;
    }

    public void setSellerfreezecharge(String sellerfreezecharge) {
        this.sellerfreezecharge = sellerfreezecharge;
    }

    public String getTradeqty() {
        return tradeqty;
    }

    public void setTradeqty(String tradeqty) {
        this.tradeqty = tradeqty;
    }

    public String getTemplatename() {
        return templatename;
    }

    public void setTemplatename(String templatename) {
        this.templatename = templatename;
    }

    public String getTrademode() {
        return trademode;
    }

    public void setTrademode(String trademode) {
        this.trademode = trademode;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getGoodsid() {
        if (goodsid == null) {
            goodsid = String.valueOf(HashTools.toHash(marketid + goodscode));
        } else if (goodsid.equals("null")) {
            goodsid = String.valueOf(HashTools.toHash(marketid + goodscode));
        }
        return goodsid;
    }

    public void setGoodsid(String goodsid) {
        this.goodsid = goodsid;
    }

    public String getTotaltradeamount() {
        return totaltradeamount;
    }

    public void setTotaltradeamount(String totaltradeamount) {
        this.totaltradeamount = totaltradeamount;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(listingid);
        dest.writeString(applyid);
        dest.writeString(tradedate);
        dest.writeString(selleraccountid);
        dest.writeString(marketid);
        dest.writeString(goodsname);
        dest.writeString(goodscode);
        dest.writeString(unit);
        dest.writeString(applyqty);
        dest.writeString(steppricetype);
        dest.writeString(goodsdesc);
        dest.writeString(goodspicurl);
        dest.writeString(decimalplace);
        dest.writeString(sellmarginalgorithm);
        dest.writeString(sellmarginvalue);
        dest.writeString(buychargealgorithm);
        dest.writeString(buychargevalue);
        dest.writeString(sellchargealgorithm);
        dest.writeString(sellchargevalue);
        dest.writeString(performancemode);
        dest.writeString(performancetemplateid);
        dest.writeString(presalestatus);
        dest.writeString(handlestatus);
        dest.writeString(createtime);
        dest.writeString(updatetime);
        dest.writeString(startday);
        dest.writeString(endday);
        dest.writeString(sellerfreezemargin);
        dest.writeString(sellerfreezecharge);
        dest.writeString(templatename);
        dest.writeString(trademode);
        dest.writeString(price);
        dest.writeString(goodsid);
        dest.writeString(mintradeqty);
        dest.writeString(tradeqty);
        dest.writeString(totaltradeamount);
    }
}
