package com.phlx.wool.entity;

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

import androidx.databinding.BaseObservable;

import com.google.gson.annotations.SerializedName;
import com.phlx.wool.util.StringConverter;

import org.greenrobot.greendao.annotation.Convert;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;

import java.util.List;
import org.greenrobot.greendao.annotation.Generated;

/**
 * 屠宰进场bean
 */

@Entity
public class EntryRegistrationEntity extends BaseObservable implements Parcelable {

    /** $column.columnComment */
    @Id(autoincrement = false)
    private Long id;

    /** 流水号 */
    private String serialNo;

    /** 牧户代码 */
    private String pastureUnitId;

    /** 牧户名称 */
    private String pastureUnitName;

    /** 进厂时间 */
    private String entryDate;

    /** 进厂数量 */
    private String entryNum;

    /** 记录人 */
    private String recorder;

    /** 检疫合格证图片 */
    private String quarantineCertificateImg;

    /** 检疫合格证姓名 */
    private String quarantineCertificateName;

    /** 检疫合格证身份证号 */
    private String quarantineCertificateIdcard;

    private String quarantineImgPath;

    /** 低频耳标集合 */
    @Convert(columnType = String.class, converter = StringConverter.class)
    private List<String> list;

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

    /** 创建时间 */
    private String createTime;

    /**
     * 数据状态 0--上传成功，1----未上传或上传失败
     */
    private int status;

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

    public EntryRegistrationEntity() {
    }

    protected EntryRegistrationEntity(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        serialNo = in.readString();
        pastureUnitId = in.readString();
        pastureUnitName = in.readString();
        entryDate = in.readString();
        entryNum = in.readString();
        recorder = in.readString();
        quarantineCertificateImg = in.readString();
        quarantineCertificateName = in.readString();
        quarantineCertificateIdcard = in.readString();
        quarantineImgPath = in.readString();
        list = in.createStringArrayList();
        createBy = in.readString();
        createTime = in.readString();
        status = in.readInt();
        if (in.readByte() == 0) {
            timestamp = null;
        } else {
            timestamp = in.readLong();
        }
    }

    @Generated(hash = 505362997)
    public EntryRegistrationEntity(Long id, String serialNo, String pastureUnitId, String pastureUnitName,
            String entryDate, String entryNum, String recorder, String quarantineCertificateImg,
            String quarantineCertificateName, String quarantineCertificateIdcard, String quarantineImgPath,
            List<String> list, String createBy, String createTime, int status, Long timestamp) {
        this.id = id;
        this.serialNo = serialNo;
        this.pastureUnitId = pastureUnitId;
        this.pastureUnitName = pastureUnitName;
        this.entryDate = entryDate;
        this.entryNum = entryNum;
        this.recorder = recorder;
        this.quarantineCertificateImg = quarantineCertificateImg;
        this.quarantineCertificateName = quarantineCertificateName;
        this.quarantineCertificateIdcard = quarantineCertificateIdcard;
        this.quarantineImgPath = quarantineImgPath;
        this.list = list;
        this.createBy = createBy;
        this.createTime = createTime;
        this.status = status;
        this.timestamp = timestamp;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (id == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(id);
        }
        dest.writeString(serialNo);
        dest.writeString(pastureUnitId);
        dest.writeString(pastureUnitName);
        dest.writeString(entryDate);
        dest.writeString(entryNum);
        dest.writeString(recorder);
        dest.writeString(quarantineCertificateImg);
        dest.writeString(quarantineCertificateName);
        dest.writeString(quarantineCertificateIdcard);
        dest.writeString(quarantineImgPath);
        dest.writeStringList(list);
        dest.writeString(createBy);
        dest.writeString(createTime);
        dest.writeInt(status);
        if (timestamp == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(timestamp);
        }
    }

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

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

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

    public Long getId() {
        return id;
    }

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

    public String getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(String serialNo) {
        this.serialNo = serialNo;
    }

    public String getPastureUnitId() {
        return pastureUnitId;
    }

    public void setPastureUnitId(String pastureUnitId) {
        this.pastureUnitId = pastureUnitId;
    }

    public String getPastureUnitName() {
        return pastureUnitName;
    }

    public void setPastureUnitName(String pastureUnitName) {
        this.pastureUnitName = pastureUnitName;
    }

    public String getEntryDate() {
        return entryDate;
    }

    public void setEntryDate(String entryDate) {
        this.entryDate = entryDate;
    }

    public String getEntryNum() {
        return entryNum;
    }

    public void setEntryNum(String entryNum) {
        this.entryNum = entryNum;
    }

    public String getRecorder() {
        return recorder;
    }

    public void setRecorder(String recorder) {
        this.recorder = recorder;
    }

    public String getQuarantineCertificateImg() {
        return quarantineCertificateImg;
    }

    public void setQuarantineCertificateImg(String quarantineCertificateImg) {
        this.quarantineCertificateImg = quarantineCertificateImg;
    }

    public String getQuarantineCertificateName() {
        return quarantineCertificateName;
    }

    public void setQuarantineCertificateName(String quarantineCertificateName) {
        this.quarantineCertificateName = quarantineCertificateName;
    }

    public String getQuarantineCertificateIdcard() {
        return quarantineCertificateIdcard;
    }

    public void setQuarantineCertificateIdcard(String quarantineCertificateIdcard) {
        this.quarantineCertificateIdcard = quarantineCertificateIdcard;
    }

    public String getQuarantineImgPath() {
        return quarantineImgPath;
    }

    public void setQuarantineImgPath(String quarantineImgPath) {
        this.quarantineImgPath = quarantineImgPath;
    }

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    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;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Long getTimestamp() {
        return timestamp;
    }

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

    @Override
    public String toString() {
        return "EntryRegistrationEntity{" +
                "id=" + id +
                ", serialNo='" + serialNo + '\'' +
                ", pastureUnitId='" + pastureUnitId + '\'' +
                ", pastureUnitName='" + pastureUnitName + '\'' +
                ", entryDate='" + entryDate + '\'' +
                ", entryNum='" + entryNum + '\'' +
                ", recorder='" + recorder + '\'' +
                ", quarantineCertificateImg='" + quarantineCertificateImg + '\'' +
                ", quarantineCertificateName='" + quarantineCertificateName + '\'' +
                ", quarantineCertificateIdcard='" + quarantineCertificateIdcard + '\'' +
                ", quarantineImgPath='" + quarantineImgPath + '\'' +
                ", list=" + list +
                ", createBy='" + createBy + '\'' +
                ", createTime='" + createTime + '\'' +
                ", status=" + status +
                ", timestamp=" + timestamp +
                '}';
    }
}
