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;

    /**
     * 旗县市代码
     */
    @SerializedName("citycode")
    private String cityCode;

    /**
     * 旗县市名称
     */
    @SerializedName("cityname")
    private String cityName;

    /**
     * 乡镇代码
     */
    @SerializedName("townscode")
    private String townsCode;

    /**
     * 乡镇名称
     */
    @SerializedName("townsname")
    private String townsName;

    /**
     * 村代码
     */
    @SerializedName("villagecode")
    private String villageCode;

    /**
     * 村名称
     */
    @SerializedName("villagename")
    private String villageName;

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

    public Unit() {
    }

    protected Unit(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        pastureUnitCode = in.readString();
        managerCode = in.readString();
        managerName = in.readString();
        idCard = in.readString();
        managerPhone = in.readString();
        cityCode = in.readString();
        cityName = in.readString();
        townsCode = in.readString();
        townsName = in.readString();
        villageCode = in.readString();
        villageName = in.readString();
        timestamp = in.readLong();
    }

    @Generated(hash = 433244320)
    public Unit(Long id, String pastureUnitCode, String managerCode,
            String managerName, String idCard, String managerPhone, String cityCode,
            String cityName, String townsCode, String townsName, String villageCode,
            String villageName, long timestamp) {
        this.id = id;
        this.pastureUnitCode = pastureUnitCode;
        this.managerCode = managerCode;
        this.managerName = managerName;
        this.idCard = idCard;
        this.managerPhone = managerPhone;
        this.cityCode = cityCode;
        this.cityName = cityName;
        this.townsCode = townsCode;
        this.townsName = townsName;
        this.villageCode = villageCode;
        this.villageName = villageName;
        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(pastureUnitCode);
        dest.writeString(managerCode);
        dest.writeString(managerName);
        dest.writeString(idCard);
        dest.writeString(managerPhone);
        dest.writeString(cityCode);
        dest.writeString(cityName);
        dest.writeString(townsCode);
        dest.writeString(townsName);
        dest.writeString(villageCode);
        dest.writeString(villageName);
        dest.writeLong(timestamp);
    }

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

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

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

    public Long getId() {
        return id;
    }

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

    public String getPastureUnitCode() {
        return pastureUnitCode;
    }

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

    public String getManagerCode() {
        return managerCode;
    }

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

    public String getManagerName() {
        return managerName;
    }

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

    public String getIdCard() {
        return idCard;
    }

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

    public String getManagerPhone() {
        return managerPhone;
    }

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

    public String getCityCode() {
        return cityCode;
    }

    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getTownsCode() {
        return townsCode;
    }

    public void setTownsCode(String townsCode) {
        this.townsCode = townsCode;
    }

    public String getTownsName() {
        return townsName;
    }

    public void setTownsName(String townsName) {
        this.townsName = townsName;
    }

    public String getVillageCode() {
        return villageCode;
    }

    public void setVillageCode(String villageCode) {
        this.villageCode = villageCode;
    }

    public String getVillageName() {
        return villageName;
    }

    public void setVillageName(String villageName) {
        this.villageName = villageName;
    }

    public long getTimestamp() {
        return timestamp;
    }

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


}
