package com.phlx.anchorcollect.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;

/**
 * 锡盟临时打标——品种bean
 */

@Entity
public class AncestryinfoEntity extends BaseObservable implements Parcelable {

    /**
     * $column.columnComment
     */
    @Id
    private Long id;

    /**
     * 品种代码
     */
    private String ancestryid;

    /**
     * 品种名称
     */
    private String ancestryname;

    private String remark;

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

    public AncestryinfoEntity() {
    }

    protected AncestryinfoEntity(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        ancestryid = in.readString();
        ancestryname = in.readString();
        remark = in.readString();
        timestamp = in.readLong();
    }

    @Generated(hash = 1906373052)
    public AncestryinfoEntity(Long id, String ancestryid, String ancestryname, String remark,
                              long timestamp) {
        this.id = id;
        this.ancestryid = ancestryid;
        this.ancestryname = ancestryname;
        this.remark = remark;
        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(ancestryid);
        dest.writeString(ancestryname);
        dest.writeString(remark);
        dest.writeLong(timestamp);
    }

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

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

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

    public Long getId() {
        return id;
    }

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

    public String getAncestryid() {
        return ancestryid;
    }

    public void setAncestryid(String ancestryid) {
        this.ancestryid = ancestryid;
    }

    public String getAncestryname() {
        return ancestryname;
    }

    public void setAncestryname(String ancestryname) {
        this.ancestryname = ancestryname;
    }

    public String getRemark() {
        return remark;
    }

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

    public long getTimestamp() {
        return timestamp;
    }

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

    @Override
    public String toString() {
        return "AncestryinfoEntity{" +
                "id=" + id +
                ", ancestryid='" + ancestryid + '\'' +
                ", ancestryname='" + ancestryname + '\'' +
                ", remark='" + remark + '\'' +
                ", timestamp=" + timestamp +
                '}';
    }
}
