package hf.lskj.com.carstockcount.db;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;

import java.io.Serializable;
import java.util.List;

import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.OrderBy;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Transient;

/**
 * Created by yaoju on 2017/7/31.
 */
@Entity
public class CarInfo implements Serializable {
    static final long serialVersionUID = 42L;
    public static final String STATUS_IN="在库";
    public static final String STATUS_MOVE="移动";
    public static final String STATUS_WEIPANDAO="未盘到";
    @Id
    private String vin;
    private String rfid;
    /*4s店Id*/
    private String storeId;
    private String color;
    /*车型*/
    private String type;
    /*在库 移动 未盘到*/
    private String status;
    private String stockCountTime;
    /*操作类型: 绑定 盘点 解绑*/
    private String stockCountType;
    /*用于盘点导出,记录导出盘点时操作员的登录id*/
    @Transient
    private String operatorId;
    @ToMany(referencedJoinProperty = "vin")
    @OrderBy("createTime DESC")
    private List<Record> records;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1794384882)
    private transient CarInfoDao myDao;
    @Generated(hash = 1914507928)
    public CarInfo(String vin, String rfid, String storeId, String color, String type, String status,
            String stockCountTime, String stockCountType) {
        this.vin = vin;
        this.rfid = rfid;
        this.storeId = storeId;
        this.color = color;
        this.type = type;
        this.status = status;
        this.stockCountTime = stockCountTime;
        this.stockCountType = stockCountType;
    }
    @Generated(hash = 850322869)
    public CarInfo() {
    }

    public String getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(String operatorId) {
        this.operatorId = operatorId;
    }

    public String getVin() {
        return this.vin;
    }
    public void setVin(String vin) {
        this.vin = vin;
    }
    public String getRfid() {
        return this.rfid;
    }
    public void setRfid(String rfid) {
        this.rfid = rfid;
    }
    public String getStoreId() {
        return this.storeId;
    }
    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }
    public String getColor() {
        return this.color;
    }
    public void setColor(String color) {
        this.color = color;
    }
    public String getType() {
        return this.type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getStatus() {
        return this.status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getStockCountTime() {
        return this.stockCountTime;
    }
    public void setStockCountTime(String stockCountTime) {
        this.stockCountTime = stockCountTime;
    }
    public String getStockCountType() {
        return this.stockCountType;
    }
    public void setStockCountType(String stockCountType) {
        this.stockCountType = stockCountType;
    }
    /**
     * 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 = 1485909093)
    public List<Record> getRecords() {
        if (records == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            RecordDao targetDao = daoSession.getRecordDao();
            List<Record> recordsNew = targetDao._queryCarInfo_Records(vin);
            synchronized (this) {
                if (records == null) {
                    records = recordsNew;
                }
            }
        }
        return records;
    }
    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 3024737)
    public synchronized void resetRecords() {
        records = 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);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 139986679)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getCarInfoDao() : null;
    }


}
