package com.phlx.wool.entity;

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

import androidx.databinding.BaseObservable;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;

/**
 * <pre>
 *     author : lei
 *     e-mail : 18600395998@163.com
 *     time   : 2020/04/10
 *     desc   : 发标记录表
 *     version: 1.0
 * </pre>
 */
@Entity
public class HarmlessDetail extends BaseObservable implements Parcelable {

    @Id(autoincrement = true)
    @Expose(serialize = false, deserialize = false)
    private Long id;

    /**
     * 主表ID
     */
    @Index(name = "harmlessId")
    private Long harmlessId;

    /**
     * 养殖单位ID
     */
    @SerializedName("preflagunit")
    private String receivingUnit;

    /**
     * 耳标EPC
     */
    @SerializedName("slugno")
    private String Epc;

    /**
     * 二维码
     */
    @SerializedName("twodimensionno")
    private String twodimensionno;

    /**
     * 耳标tid
     */
    @Index(name = "HarmlessTid", unique = true)
    @SerializedName("innercode")
    private String Tid;

    /**
     * 合法状态 0 非法 1 合法
     */
    @SerializedName("qualified")
    private String isLegalStatus;

    /**
     * 时间戳
     */
    @SerializedName("inputTime")
    private long timestamp;

    /** 创建者 */
    private String createBy;

    /**
     * 创建时间
     */
    @Expose(serialize = false, deserialize = false)
    private String createTime;

    public HarmlessDetail() {
    }

    protected HarmlessDetail(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        if (in.readByte() == 0) {
            harmlessId = null;
        } else {
            harmlessId = in.readLong();
        }
        receivingUnit = in.readString();
        Epc = in.readString();
        twodimensionno = in.readString();
        Tid = in.readString();
        isLegalStatus = in.readString();
        timestamp = in.readLong();
        createBy = in.readString();
        createTime = in.readString();
    }

    @Generated(hash = 1267726135)
    public HarmlessDetail(Long id, Long harmlessId, String receivingUnit, String Epc,
            String twodimensionno, String Tid, String isLegalStatus, long timestamp,
            String createBy, String createTime) {
        this.id = id;
        this.harmlessId = harmlessId;
        this.receivingUnit = receivingUnit;
        this.Epc = Epc;
        this.twodimensionno = twodimensionno;
        this.Tid = Tid;
        this.isLegalStatus = isLegalStatus;
        this.timestamp = timestamp;
        this.createBy = createBy;
        this.createTime = createTime;
    }

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

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

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getHarmlessId() {
        return harmlessId;
    }

    public void setHarmlessId(Long harmlessId) {
        this.harmlessId = harmlessId;
    }

    public String getReceivingUnit() {
        return receivingUnit;
    }

    public void setReceivingUnit(String receivingUnit) {
        this.receivingUnit = receivingUnit;
    }

    public String getEpc() {
        return Epc;
    }

    public void setEpc(String epc) {
        Epc = epc;
    }

    public String getTwodimensionno() {
        return twodimensionno;
    }

    public void setTwodimensionno(String twodimensionno) {
        this.twodimensionno = twodimensionno;
    }

    public String getTid() {
        return Tid;
    }

    public void setTid(String tid) {
        Tid = tid;
    }

    public String getIsLegalStatus() {
        return isLegalStatus;
    }

    public void setIsLegalStatus(String isLegalStatus) {
        this.isLegalStatus = isLegalStatus;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

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

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        if (id == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeLong(id);
        }
        if (harmlessId == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeLong(harmlessId);
        }
        parcel.writeString(receivingUnit);
        parcel.writeString(Epc);
        parcel.writeString(twodimensionno);
        parcel.writeString(Tid);
        parcel.writeString(isLegalStatus);
        parcel.writeLong(timestamp);
        parcel.writeString(createBy);
        parcel.writeString(createTime);
    }
}


