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.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;

/**
 * <pre>
 *     author : lei
 *     e-mail : 18600395998@163.com
 *     time   : 2020/04/10
 *     desc   : 检疫表
 *     version: 1.0
 * </pre>
 */
@Entity
public class Quarantine extends BaseObservable implements Parcelable {
    @Id(autoincrement = true)
    @Expose(serialize = false, deserialize = false)
    private Long id;

    /**
     * 检疫时间
     */
    @SerializedName("quarantinedate")
    private String quarantineTime;
    /**
     * 养殖单位名称
     */
    @SerializedName("managername")
    private String managerName;
    /**
     * 养殖单位代码
     */
    @SerializedName("pastureunitid")
    private String managerCode;

    /**
     * 联系电话
     */
    @SerializedName("managerphone")
    private String managerPhone;


    /**
     * 检疫地点
     */
    @SerializedName("quarantineplace")
    private String quarantinePlace;

    /**
     * 动物种类代码
     */
    @SerializedName("animaltype")
    private String VarietyCode;
    /**
     * 动物种类名称
     */
    @SerializedName("VarietyName")
    private String VarietyName;

    /**
     * 检疫数量
     */
    @SerializedName("quarantinecount")
    private String quarantineNum;

    /**
     * 合格数量
     */
    @SerializedName("qualifiedcount")
    private String qualifiedNum;

    /**
     * 不合格数量
     */
    @SerializedName("unqualifiedcount")
    private String unqualifiedNum;

    /**
     * 不合格原因
     */
    @SerializedName("unqualifiedreason")
    private String unqualifiedReason;

    /**
     * 不合格处理方式
     */
    @SerializedName("manageunqualifiedway")
    private String manageUnqualifiedWay;

    /**
     * 免疫证号
     */
    @SerializedName("immunecardid")
    private String immuneCardCode;

    /**
     * 免疫时间
     */
    @SerializedName("immunedate")
    private String immuneDate;

    /**
     * 现场检疫情况
     */
    @SerializedName("quarantinecondition")
    private String quarantineCondition;

    /**
     * 出具检疫证单位
     */
    @SerializedName("issuequacardunit")
    private String issueQuarantineUnit;

    /**
     * 检疫证号码
     */
    @SerializedName("quarantinecardid")
    private String quarantineCardCode;
    /**
     * 检疫人员代码
     */
    @SerializedName("quarantinePersonCode")
    private String quarantinePersonCode;
    /**
     * 检疫人员名称
     */
    @SerializedName("quarantineperson")
    private String quarantinePerson;

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

    /**
     * 状态
     */
    private String state;
    /**
     * 备注
     */
    @SerializedName("remark")
    private String remark;

    @ToMany(referencedJoinProperty ="quarantineId")
    private List<QuarantineDetail> list;

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

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

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 125712450)
    private transient QuarantineDao myDao;

    public Quarantine() {
    }

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

    @Generated(hash = 1087837699)
    public Quarantine(Long id, String quarantineTime, String managerName,
            String managerCode, String managerPhone, String quarantinePlace,
            String VarietyCode, String VarietyName, String quarantineNum,
            String qualifiedNum, String unqualifiedNum, String unqualifiedReason,
            String manageUnqualifiedWay, String immuneCardCode, String immuneDate,
            String quarantineCondition, String issueQuarantineUnit,
            String quarantineCardCode, String quarantinePersonCode,
            String quarantinePerson, int status, String state, String remark,
            String createBy, String createTime) {
        this.id = id;
        this.quarantineTime = quarantineTime;
        this.managerName = managerName;
        this.managerCode = managerCode;
        this.managerPhone = managerPhone;
        this.quarantinePlace = quarantinePlace;
        this.VarietyCode = VarietyCode;
        this.VarietyName = VarietyName;
        this.quarantineNum = quarantineNum;
        this.qualifiedNum = qualifiedNum;
        this.unqualifiedNum = unqualifiedNum;
        this.unqualifiedReason = unqualifiedReason;
        this.manageUnqualifiedWay = manageUnqualifiedWay;
        this.immuneCardCode = immuneCardCode;
        this.immuneDate = immuneDate;
        this.quarantineCondition = quarantineCondition;
        this.issueQuarantineUnit = issueQuarantineUnit;
        this.quarantineCardCode = quarantineCardCode;
        this.quarantinePersonCode = quarantinePersonCode;
        this.quarantinePerson = quarantinePerson;
        this.status = status;
        this.state = state;
        this.remark = remark;
        this.createBy = createBy;
        this.createTime = createTime;
    }

    protected Quarantine(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        quarantineTime = in.readString();
        managerName = in.readString();
        managerCode = in.readString();
        managerPhone = in.readString();
        quarantinePlace = in.readString();
        VarietyCode = in.readString();
        VarietyName = in.readString();
        quarantineNum = in.readString();
        qualifiedNum = in.readString();
        unqualifiedNum = in.readString();
        unqualifiedReason = in.readString();
        manageUnqualifiedWay = in.readString();
        immuneCardCode = in.readString();
        immuneDate = in.readString();
        quarantineCondition = in.readString();
        issueQuarantineUnit = in.readString();
        quarantineCardCode = in.readString();
        quarantinePersonCode = in.readString();
        quarantinePerson = in.readString();
        status = in.readInt();
        state = in.readString();
        remark = in.readString();
        list = in.createTypedArrayList(QuarantineDetail.CREATOR);
        createBy = in.readString();
        createTime = in.readString();
    }

    @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(quarantineTime);
        dest.writeString(managerName);
        dest.writeString(managerCode);
        dest.writeString(managerPhone);
        dest.writeString(quarantinePlace);
        dest.writeString(VarietyCode);
        dest.writeString(VarietyName);
        dest.writeString(quarantineNum);
        dest.writeString(qualifiedNum);
        dest.writeString(unqualifiedNum);
        dest.writeString(unqualifiedReason);
        dest.writeString(manageUnqualifiedWay);
        dest.writeString(immuneCardCode);
        dest.writeString(immuneDate);
        dest.writeString(quarantineCondition);
        dest.writeString(issueQuarantineUnit);
        dest.writeString(quarantineCardCode);
        dest.writeString(quarantinePersonCode);
        dest.writeString(quarantinePerson);
        dest.writeInt(status);
        dest.writeString(state);
        dest.writeString(remark);
        dest.writeTypedList(list);
        dest.writeString(createBy);
        dest.writeString(createTime);
    }

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

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

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

    public Long getId() {
        return this.id;
    }

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

    public String getQuarantineTime() {
        return this.quarantineTime;
    }

    public void setQuarantineTime(String quarantineTime) {
        this.quarantineTime = quarantineTime;
    }

    public String getManagerName() {
        return this.managerName;
    }

    public void setManagerName(String managerName) {
        this.managerName = managerName;
    }

    public String getManagerCode() {
        return this.managerCode;
    }

    public void setManagerCode(String managerCode) {
        this.managerCode = managerCode;
    }

    public String getManagerPhone() {
        return this.managerPhone;
    }

    public void setManagerPhone(String managerPhone) {
        this.managerPhone = managerPhone;
    }

    public String getQuarantinePlace() {
        return this.quarantinePlace;
    }

    public void setQuarantinePlace(String quarantinePlace) {
        this.quarantinePlace = quarantinePlace;
    }

    public String getVarietyCode() {
        return this.VarietyCode;
    }

    public void setVarietyCode(String VarietyCode) {
        this.VarietyCode = VarietyCode;
    }

    public String getVarietyName() {
        return this.VarietyName;
    }

    public void setVarietyName(String VarietyName) {
        this.VarietyName = VarietyName;
    }

    public String getQuarantineNum() {
        return this.quarantineNum;
    }

    public void setQuarantineNum(String quarantineNum) {
        this.quarantineNum = quarantineNum;
    }

    public String getQualifiedNum() {
        return this.qualifiedNum;
    }

    public void setQualifiedNum(String qualifiedNum) {
        this.qualifiedNum = qualifiedNum;
    }

    public String getUnqualifiedNum() {
        return this.unqualifiedNum;
    }

    public void setUnqualifiedNum(String unqualifiedNum) {
        this.unqualifiedNum = unqualifiedNum;
    }

    public String getUnqualifiedReason() {
        return this.unqualifiedReason;
    }

    public void setUnqualifiedReason(String unqualifiedReason) {
        this.unqualifiedReason = unqualifiedReason;
    }

    public String getManageUnqualifiedWay() {
        return this.manageUnqualifiedWay;
    }

    public void setManageUnqualifiedWay(String manageUnqualifiedWay) {
        this.manageUnqualifiedWay = manageUnqualifiedWay;
    }

    public String getImmuneCardCode() {
        return this.immuneCardCode;
    }

    public void setImmuneCardCode(String immuneCardCode) {
        this.immuneCardCode = immuneCardCode;
    }

    public String getImmuneDate() {
        return this.immuneDate;
    }

    public void setImmuneDate(String immuneDate) {
        this.immuneDate = immuneDate;
    }

    public String getQuarantineCondition() {
        return this.quarantineCondition;
    }

    public void setQuarantineCondition(String quarantineCondition) {
        this.quarantineCondition = quarantineCondition;
    }

    public String getIssueQuarantineUnit() {
        return this.issueQuarantineUnit;
    }

    public void setIssueQuarantineUnit(String issueQuarantineUnit) {
        this.issueQuarantineUnit = issueQuarantineUnit;
    }

    public String getQuarantineCardCode() {
        return this.quarantineCardCode;
    }

    public void setQuarantineCardCode(String quarantineCardCode) {
        this.quarantineCardCode = quarantineCardCode;
    }

    public String getQuarantinePersonCode() {
        return this.quarantinePersonCode;
    }

    public void setQuarantinePersonCode(String quarantinePersonCode) {
        this.quarantinePersonCode = quarantinePersonCode;
    }

    public String getQuarantinePerson() {
        return this.quarantinePerson;
    }

    public void setQuarantinePerson(String quarantinePerson) {
        this.quarantinePerson = quarantinePerson;
    }

    public int getStatus() {
        return this.status;
    }

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

    public String getState() {
        return this.state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getRemark() {
        return this.remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getCreateBy() {
        return this.createBy;
    }

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

    public String getCreateTime() {
        return this.createTime;
    }

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

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1037407869)
    public List<QuarantineDetail> getList() {
        if (list == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            QuarantineDetailDao targetDao = daoSession.getQuarantineDetailDao();
            List<QuarantineDetail> listNew = targetDao._queryQuarantine_List(id);
            synchronized (this) {
                if (list == null) {
                    list = listNew;
                }
            }
        }
        return list;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 589833612)
    public synchronized void resetList() {
        list = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    @Override
    public String toString() {
        return "Quarantine{" +
                "id=" + id +
                ", quarantineTime='" + quarantineTime + '\'' +
                ", managerName='" + managerName + '\'' +
                ", managerCode='" + managerCode + '\'' +
                ", managerPhone='" + managerPhone + '\'' +
                ", quarantinePlace='" + quarantinePlace + '\'' +
                ", VarietyCode='" + VarietyCode + '\'' +
                ", VarietyName='" + VarietyName + '\'' +
                ", quarantineNum='" + quarantineNum + '\'' +
                ", qualifiedNum='" + qualifiedNum + '\'' +
                ", unqualifiedNum='" + unqualifiedNum + '\'' +
                ", unqualifiedReason='" + unqualifiedReason + '\'' +
                ", manageUnqualifiedWay='" + manageUnqualifiedWay + '\'' +
                ", immuneCardCode='" + immuneCardCode + '\'' +
                ", immuneDate='" + immuneDate + '\'' +
                ", quarantineCondition='" + quarantineCondition + '\'' +
                ", issueQuarantineUnit='" + issueQuarantineUnit + '\'' +
                ", quarantineCardCode='" + quarantineCardCode + '\'' +
                ", quarantinePersonCode='" + quarantinePersonCode + '\'' +
                ", quarantinePerson='" + quarantinePerson + '\'' +
                ", status=" + status +
                ", state='" + state + '\'' +
                ", remark='" + remark + '\'' +
                ", list=" + list +
                ", createBy='" + createBy + '\'' +
                ", createTime='" + createTime + '\'' +
                ", daoSession=" + daoSession +
                ", myDao=" + myDao +
                '}';
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 220243497)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getQuarantineDao() : null;
    }
}
