package com.phlx.wool.entity;

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

import androidx.databinding.BaseObservable;

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

    @Id(autoincrement = false)
    private Long id;

    /**
     * 代码
     */
    @SerializedName("pastureunitid")
    private String pastureUnitCode;

    /**
     * 负责人编码
     */
    @SerializedName("managerid")
    private String managerCode;

    /**
     * 负责人名称
     */
    @SerializedName("managername")
    private String managerName;

    /**
     * 身份证号
     */
    @SerializedName("idcard")
    private String idCard;

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


    /**
     * 时间戳
     */
    @Index(name = "unitTime", unique = false)
    @SerializedName("inputTime")
    private long timestamp;




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


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


    public String getPastureUnitCode() {
        return this.pastureUnitCode;
    }


    public void setPastureUnitCode(String pastureUnitCode) {
        this.pastureUnitCode = pastureUnitCode;
    }


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


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


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


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


    public String getIdCard() {
        return this.idCard;
    }


    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }


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


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


    public long getTimestamp() {
        return this.timestamp;
    }


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


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

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.id);
        dest.writeString(this.pastureUnitCode);
        dest.writeString(this.managerCode);
        dest.writeString(this.managerName);
        dest.writeString(this.idCard);
        dest.writeString(this.managerPhone);
        dest.writeLong(this.timestamp);
    }

    protected Unit(Parcel in) {
        this.id = (Long) in.readValue(Long.class.getClassLoader());
        this.pastureUnitCode = in.readString();
        this.managerCode = in.readString();
        this.managerName = in.readString();
        this.idCard = in.readString();
        this.managerPhone = in.readString();
        this.timestamp = in.readLong();
    }


    @Generated(hash = 730934383)
    public Unit(Long id, String pastureUnitCode, String managerCode,
            String managerName, String idCard, String managerPhone,
            long timestamp) {
        this.id = id;
        this.pastureUnitCode = pastureUnitCode;
        this.managerCode = managerCode;
        this.managerName = managerName;
        this.idCard = idCard;
        this.managerPhone = managerPhone;
        this.timestamp = timestamp;
    }


    @Generated(hash = 1236212320)
    public Unit() {
    }

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

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

    @Override
    public String toString() {
        return "Unit{" +
                "id=" + id +
                ", pastureUnitCode='" + pastureUnitCode + '\'' +
                ", managerCode='" + managerCode + '\'' +
                ", managerName='" + managerName + '\'' +
                ", idCard='" + idCard + '\'' +
                ", managerPhone='" + managerPhone + '\'' +
                ", timestamp=" + timestamp +
                '}';
    }
}
