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 Harmless extends BaseObservable implements Parcelable {

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

    /**
     * 养殖单位名称
     */
    @SerializedName("managername")
    private String managerName;
    /**
     * 养殖单位代码
     */
    @SerializedName("pastureunitid")
    private String managerCode;

    /**
     * 死亡原因
     */
    @SerializedName("diereason")
    private String deathReason;

    /**
     * 处理方法代码
     */
    @SerializedName("innocuitymanageid")
    private String TreatmentMethodCode;
    /**
     * 处理方法名称
     */
    @SerializedName("innocuitymanagename")
    private String TreatmentMethodName;

    /**
     * 发病时间
     */
    @SerializedName("attackdate")
    private String onsetTime;

    /**
     * 死亡时间
     */
    @SerializedName("diedate")
    private String deathTime;

    /**
     * 处理数量
     */
    @SerializedName("dispose")
    private String TreatmentNum;

    /**
     * 处理单位
     */
    @SerializedName("manageunit")
    private String TreatmentUnit;


    /**
     * 处理人员代码
     */
    @SerializedName("veterinaryCode")
    private String veterinaryCode;

    /**
     * 处理人员
     */
    @SerializedName("manageperson")
    private String veterinaryName;

    /**
     * 处理时间
     */
    @SerializedName("managedate")
    private String TreatmentTime;

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

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

    @ToMany(referencedJoinProperty = "harmlessId")
    private List<HarmlessDetail> list;

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

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

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

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



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

    @Generated(hash = 1389738217)
    public Harmless(Long id, String managerName, String managerCode,
            String deathReason, String TreatmentMethodCode,
            String TreatmentMethodName, String onsetTime, String deathTime,
            String TreatmentNum, String TreatmentUnit, String veterinaryCode,
            String veterinaryName, String TreatmentTime, int status, String remark,
            String createBy, String createTime) {
        this.id = id;
        this.managerName = managerName;
        this.managerCode = managerCode;
        this.deathReason = deathReason;
        this.TreatmentMethodCode = TreatmentMethodCode;
        this.TreatmentMethodName = TreatmentMethodName;
        this.onsetTime = onsetTime;
        this.deathTime = deathTime;
        this.TreatmentNum = TreatmentNum;
        this.TreatmentUnit = TreatmentUnit;
        this.veterinaryCode = veterinaryCode;
        this.veterinaryName = veterinaryName;
        this.TreatmentTime = TreatmentTime;
        this.status = status;
        this.remark = remark;
        this.createBy = createBy;
        this.createTime = createTime;
    }

    @Generated(hash = 729317827)
    public Harmless() {
    }

    protected Harmless(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        managerName = in.readString();
        managerCode = in.readString();
        deathReason = in.readString();
        TreatmentMethodCode = in.readString();
        TreatmentMethodName = in.readString();
        onsetTime = in.readString();
        deathTime = in.readString();
        TreatmentNum = in.readString();
        TreatmentUnit = in.readString();
        veterinaryCode = in.readString();
        veterinaryName = in.readString();
        TreatmentTime = in.readString();
        status = in.readInt();
        remark = in.readString();
        list = in.createTypedArrayList(HarmlessDetail.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(managerName);
        dest.writeString(managerCode);
        dest.writeString(deathReason);
        dest.writeString(TreatmentMethodCode);
        dest.writeString(TreatmentMethodName);
        dest.writeString(onsetTime);
        dest.writeString(deathTime);
        dest.writeString(TreatmentNum);
        dest.writeString(TreatmentUnit);
        dest.writeString(veterinaryCode);
        dest.writeString(veterinaryName);
        dest.writeString(TreatmentTime);
        dest.writeInt(status);
        dest.writeString(remark);
        dest.writeTypedList(list);
        dest.writeString(createBy);
        dest.writeString(createTime);
    }

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

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

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

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

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

    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 getDeathReason() {
        return this.deathReason;
    }

    public void setDeathReason(String deathReason) {
        this.deathReason = deathReason;
    }

    public String getTreatmentMethodCode() {
        return this.TreatmentMethodCode;
    }

    public void setTreatmentMethodCode(String TreatmentMethodCode) {
        this.TreatmentMethodCode = TreatmentMethodCode;
    }

    public String getTreatmentMethodName() {
        return this.TreatmentMethodName;
    }

    public void setTreatmentMethodName(String TreatmentMethodName) {
        this.TreatmentMethodName = TreatmentMethodName;
    }

    public String getOnsetTime() {
        return this.onsetTime;
    }

    public void setOnsetTime(String onsetTime) {
        this.onsetTime = onsetTime;
    }

    public String getDeathTime() {
        return this.deathTime;
    }

    public void setDeathTime(String deathTime) {
        this.deathTime = deathTime;
    }

    public String getTreatmentNum() {
        return this.TreatmentNum;
    }

    public void setTreatmentNum(String TreatmentNum) {
        this.TreatmentNum = TreatmentNum;
    }

    public String getTreatmentUnit() {
        return this.TreatmentUnit;
    }

    public void setTreatmentUnit(String TreatmentUnit) {
        this.TreatmentUnit = TreatmentUnit;
    }

    public String getVeterinaryCode() {
        return this.veterinaryCode;
    }

    public void setVeterinaryCode(String veterinaryCode) {
        this.veterinaryCode = veterinaryCode;
    }

    public String getVeterinaryName() {
        return this.veterinaryName;
    }

    public void setVeterinaryName(String veterinaryName) {
        this.veterinaryName = veterinaryName;
    }

    public String getTreatmentTime() {
        return this.TreatmentTime;
    }

    public void setTreatmentTime(String TreatmentTime) {
        this.TreatmentTime = TreatmentTime;
    }

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

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

    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 = 214897825)
    public List<HarmlessDetail> getList() {
        if (list == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            HarmlessDetailDao targetDao = daoSession.getHarmlessDetailDao();
            List<HarmlessDetail> listNew = targetDao._queryHarmless_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 "Harmless{" +
                "id=" + id +
                ", managerName='" + managerName + '\'' +
                ", managerCode='" + managerCode + '\'' +
                ", deathReason='" + deathReason + '\'' +
                ", TreatmentMethodCode='" + TreatmentMethodCode + '\'' +
                ", TreatmentMethodName='" + TreatmentMethodName + '\'' +
                ", onsetTime='" + onsetTime + '\'' +
                ", deathTime='" + deathTime + '\'' +
                ", TreatmentNum='" + TreatmentNum + '\'' +
                ", TreatmentUnit='" + TreatmentUnit + '\'' +
                ", veterinaryCode='" + veterinaryCode + '\'' +
                ", veterinaryName='" + veterinaryName + '\'' +
                ", TreatmentTime='" + TreatmentTime + '\'' +
                ", status=" + status +
                ", remark='" + remark + '\'' +
                ", list=" + list +
                ", createBy='" + createBy + '\'' +
                ", createTime='" + createTime + '\'' +
                ", daoSession=" + daoSession +
                ", myDao=" + myDao +
                '}';
    }

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