package com.gingersoft.gsa.cloud.database.bean;

import android.graphics.Color;
import android.text.TextUtils;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Transient;

import java.util.Date;
import org.greenrobot.greendao.DaoException;
import com.gingersoft.gsa.cloud.database.greendao.DaoSession;
import com.gingersoft.gsa.cloud.database.greendao.ColorBeanDao;
import org.greenrobot.greendao.annotation.NotNull;
import com.gingersoft.gsa.cloud.database.greendao.ModifierDao;

/**
 * 作者：ELEGANT_BIN
 * 版本：1.6.0
 * 创建日期：2020-02-18
 * 修订历史：2020-02-18
 * 描述：
 */
@Entity
public class Modifier {

    @Property(nameInDb = "_id")
    @Id(autoincrement = true)
    private Long dbid;

    private long mid;
    /**
     * 食品分类ID
     */
    private long topId;

    private long restaurantId;

    private String modifierName;

    private long seqNo;

    private double marketPrice;

    private double price;

    /**
     * 餐盒费
     */
    private double lunchboxPrice;

    /**
     * 圖片
     */
    private String imageUrl;
    /**
     * 0=顯示, 1=隱藏, 2=暫停
     */
    private long invisible;
    /**
     * 成本
     */
    private double cost;
    /**
     * 開始日期
     */
    private Date startDate;
    /**
     * 結束日期
     */
    private Date endDate;
    /**
     * 贊
     */
    private long like;
    /**
     * 已售
     */
    private long totalSold;
    /**
     * gspos自定义表中的Id
     */
    private long majorMainId;
    /**
     * 報表部門分組
     */
    private long deptId;
    /**
     * 创建人
     */
    private String createBy;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新人
     */
    private String updateBy;
    /**
     * 更新时间
     */
    private Date updateTime;
    /**
     * 本地对应ID
     */
    private String posFid;
    /**
     * 父级ID
     */
    private String pId;
    /**
     * 細項下有細項時, 是否自動打開細項 0=不開開 1=打開
     */
    private long autoMod;
    /**
     * 頁面中藍色按鈕有沒有編輯按鈕  (筆的圖按) 0=不可編輯 1=可編輯
     */
    private long blueEdit;
    /**
     * 相同項目自動合併  0=不自動合併 1=自動合併
     */
    private long autoMerge;
    /**
     * 自定義細項 (如細項有下一層, 當層的自定義細項會失效) 0=否 1=是
     */
    private long customMsg;
    /**
     * 是否組別  1 为组别
     */
    private long isParent;
    /**
     * 食品名称1
     */
    private String modifierName1;
    /**
     * 食品名称2
     */
    private String modifierName2;
    /**
     * 金額=-994時, 取這個數值乘主項金額
     */
    private double multiple;
    /**
     * 打印設定
     */
    private String printSet;
    /**
     * 廚房打印設定
     */
    private String ktSetting;
    /**
     * 多選
     */
    private long modComm;
    /**
     * 口味
     */
    private long modTaste;
    /**
     * 訊息
     */
    private long modMsg;
    /**
     * TRUE=追單, FALSE=不處理
     */
    private long ktFireCourse;
    /**
     * 是否参与折扣#1:可折扣
     */
    private long ableDisCount;
    /**
     * 打印到帳單
     */
    private long printToBill;
    /**
     * 廚房單打印主項
     */
    private long ktPrintMainItem;
    /**
     * 廚房單顯示單價
     */
    private long ktShowPrice;
    /**
     * 廚房打印顏色
     */
    private long ktFont;
    /**
     * 0:新增；1：修改：2刪除
     */
    private long conditions;
    /**
     * 是否同步 0：否 1：是
     */
    private long isRt;
    /**
     * 隱藏
     */
    private byte visible;
    /**
     * 是否删除：0正常，1删除
     */
    private long deletes;
    /**
     * 是否參與會員喜好統計 0 參與  1 不參與
     */
    private long isStatistic;
    /**
     * 顏色ID
     */
    private long colorId;

    @ToOne(joinProperty = "colorId") //这个是注解绑定 hid就是上面一行的colorId
    private ColorBean colorBean;


    /**
     * 自定義字段
     */
    /** 當前食品ID*/
    @Transient
    private long fid;
    @Transient
    /**選中數量*/
    private int number;
    @Transient
    /**背景顏色*/
    private int bgColor = Color.parseColor("#069683");
    @Transient
    /**字體顏色*/
    private int fontColor = Color.parseColor("#FFFFFF");
    @Transient
    /**最大可選數*/
    private int selectQty;
    /**最大選中數*/
    @Transient
    private String maxNumber = "";
    /**動態的最大選中數*/
    @Transient
    private String currentMaxNumber= "";
    /**是否售罄*/
    @Transient
    private boolean isSoldout = false;
    /** 默認選中數*/
    @Transient
    private String defmodifier = "0";
    @Transient
    /**是否選中*/
    private boolean selected;
    @Transient
    /**是否細項組返回按鈕*/
    private boolean isReturn = false;

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

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

    @Generated(hash = 292980300)
    private transient Long colorBean__resolvedKey;



    @Generated(hash = 1099399041)
    public Modifier(Long dbid, long mid, long topId, long restaurantId, String modifierName, long seqNo, double marketPrice,
            double price, double lunchboxPrice, String imageUrl, long invisible, double cost, Date startDate, Date endDate,
            long like, long totalSold, long majorMainId, long deptId, String createBy, Date createTime, String updateBy,
            Date updateTime, String posFid, String pId, long autoMod, long blueEdit, long autoMerge, long customMsg,
            long isParent, String modifierName1, String modifierName2, double multiple, String printSet, String ktSetting,
            long modComm, long modTaste, long modMsg, long ktFireCourse, long ableDisCount, long printToBill,
            long ktPrintMainItem, long ktShowPrice, long ktFont, long conditions, long isRt, byte visible, long deletes,
            long isStatistic, long colorId) {
        this.dbid = dbid;
        this.mid = mid;
        this.topId = topId;
        this.restaurantId = restaurantId;
        this.modifierName = modifierName;
        this.seqNo = seqNo;
        this.marketPrice = marketPrice;
        this.price = price;
        this.lunchboxPrice = lunchboxPrice;
        this.imageUrl = imageUrl;
        this.invisible = invisible;
        this.cost = cost;
        this.startDate = startDate;
        this.endDate = endDate;
        this.like = like;
        this.totalSold = totalSold;
        this.majorMainId = majorMainId;
        this.deptId = deptId;
        this.createBy = createBy;
        this.createTime = createTime;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
        this.posFid = posFid;
        this.pId = pId;
        this.autoMod = autoMod;
        this.blueEdit = blueEdit;
        this.autoMerge = autoMerge;
        this.customMsg = customMsg;
        this.isParent = isParent;
        this.modifierName1 = modifierName1;
        this.modifierName2 = modifierName2;
        this.multiple = multiple;
        this.printSet = printSet;
        this.ktSetting = ktSetting;
        this.modComm = modComm;
        this.modTaste = modTaste;
        this.modMsg = modMsg;
        this.ktFireCourse = ktFireCourse;
        this.ableDisCount = ableDisCount;
        this.printToBill = printToBill;
        this.ktPrintMainItem = ktPrintMainItem;
        this.ktShowPrice = ktShowPrice;
        this.ktFont = ktFont;
        this.conditions = conditions;
        this.isRt = isRt;
        this.visible = visible;
        this.deletes = deletes;
        this.isStatistic = isStatistic;
        this.colorId = colorId;
    }

    @Generated(hash = 385685553)
    public Modifier() {
    }



    public Long getDbid() {
        return dbid;
    }

    public String getName(){
        return modifierName;
    }

    public long getMid() {
        return mid;
    }

    public boolean isSold() {
        if(!TextUtils.isEmpty(currentMaxNumber) && ("售罄".equals(currentMaxNumber) || "暫停".equals(currentMaxNumber))){
            return true;
        }
        return false;
    }

    public Long getTopId() {
        return topId;
    }

    public Long getRestaurantId() {
        return restaurantId;
    }

    public String getModifierName() {
        return modifierName;
    }

    public Long getSeqNo() {
        return seqNo;
    }

    public Double getMarketPrice() {
        return marketPrice;
    }

    public Double getPrice() {
        return price;
    }

    public Double getLunchboxPrice() {
        return lunchboxPrice;
    }

    public Long getColorId() {
        return colorId;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public Long getInvisible() {
        return invisible;
    }

    public Double getCost() {
        return cost;
    }

    public Date getStartDate() {
        return startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public Long getLike() {
        return like;
    }

    public Long getTotalSold() {
        return totalSold;
    }

    public Long getMajorMainId() {
        return majorMainId;
    }

    public Long getDeptId() {
        return deptId;
    }

    public String getCreateBy() {
        return createBy;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public String getPosFid() {
        return posFid;
    }

    public String getpId() {
        return pId;
    }

    public Long getAutoMod() {
        return autoMod;
    }

    public Long getBlueEdit() {
        return blueEdit;
    }

    public Long getAutoMerge() {
        return autoMerge;
    }

    public Long getCustomMsg() {
        return customMsg;
    }

    public boolean isParent() {
        if (isParent == 1) {
            return true;
        }
        return false;
    }

    public Long getIsParent() {
        return isParent;
    }

    public String getModifierName1() {
        return modifierName1;
    }

    public String getModifierName2() {
        return modifierName2;
    }

    public Double getMultiple() {
        return multiple;
    }

    public String getPrintSet() {
        return printSet;
    }

    public String getKtSetting() {
        return ktSetting;
    }

    public Long getModComm() {
        return modComm;
    }

    public Long getModTaste() {
        return modTaste;
    }

    public Long getModMsg() {
        return modMsg;
    }

    public Long getKtFireCourse() {
        return ktFireCourse;
    }

    public Long getAbleDisCount() {
        return ableDisCount;
    }

    public Long getPrintToBill() {
        return printToBill;
    }

    public Long getKtPrintMainItem() {
        return ktPrintMainItem;
    }

    public Long getKtShowPrice() {
        return ktShowPrice;
    }

    public Long getKtFont() {
        return ktFont;
    }

    public Long getConditions() {
        return conditions;
    }

    public Long getIsRt() {
        return isRt;
    }

    public Byte getVisible() {
        return visible;
    }

    public Long getDeletes() {
        return deletes;
    }

    public Long getIsStatistic() {
        return isStatistic;
    }

    public long getFid() {
        return fid;
    }

    public int getNumber() {
        return number;
    }

    public int getBgColor() {
        return bgColor;
    }

    public int getFontColor() {
        return fontColor;
    }

    public String getMaxNumber() {
        return maxNumber;
    }

    public String getCurrentMaxNumber() {
        return currentMaxNumber;
    }

    public void setCurrentMaxNumber(String currentMaxNumber) {
        this.currentMaxNumber = currentMaxNumber;
    }

    public boolean isSelected() {
        return selected;
    }

    public boolean isReturn() {
        return isReturn;
    }

    public void setDbid(Long dbid) {
        this.dbid = dbid;
    }

    public void setTopId(Long topId) {
        this.topId = topId;
    }

    public void setRestaurantId(Long restaurantId) {
        this.restaurantId = restaurantId;
    }

    public void setModifierName(String modifierName) {
        this.modifierName = modifierName;
    }

    public void setSeqNo(Long seqNo) {
        this.seqNo = seqNo;
    }

    public void setMarketPrice(Double marketPrice) {
        this.marketPrice = marketPrice;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public void setLunchboxPrice(Double lunchboxPrice) {
        this.lunchboxPrice = lunchboxPrice;
    }

    public void setColorId(Long colorId) {
        this.colorId = colorId;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public void setCost(Double cost) {
        this.cost = cost;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public void setLike(Long like) {
        this.like = like;
    }

    public void setTotalSold(Long totalSold) {
        this.totalSold = totalSold;
    }

    public void setMajorMainId(Long majorMainId) {
        this.majorMainId = majorMainId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public void setPosFid(String posFid) {
        this.posFid = posFid;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public void setAutoMod(Long autoMod) {
        this.autoMod = autoMod;
    }

    public void setBlueEdit(Long blueEdit) {
        this.blueEdit = blueEdit;
    }

    public void setAutoMerge(Long autoMerge) {
        this.autoMerge = autoMerge;
    }

    public void setCustomMsg(Long customMsg) {
        this.customMsg = customMsg;
    }

    public void setIsParent(Long isParent) {
        this.isParent = isParent;
    }

    public void setModifierName1(String modifierName1) {
        this.modifierName1 = modifierName1;
    }

    public void setModifierName2(String modifierName2) {
        this.modifierName2 = modifierName2;
    }

    public void setMultiple(Double multiple) {
        this.multiple = multiple;
    }

    public void setPrintSet(String printSet) {
        this.printSet = printSet;
    }

    public void setKtSetting(String ktSetting) {
        this.ktSetting = ktSetting;
    }

    public void setModComm(Long modComm) {
        this.modComm = modComm;
    }

    public void setModTaste(Long modTaste) {
        this.modTaste = modTaste;
    }

    public void setModMsg(Long modMsg) {
        this.modMsg = modMsg;
    }

    public void setKtFireCourse(Long ktFireCourse) {
        this.ktFireCourse = ktFireCourse;
    }

    public void setAbleDisCount(Long ableDisCount) {
        this.ableDisCount = ableDisCount;
    }

    public void setPrintToBill(Long printToBill) {
        this.printToBill = printToBill;
    }

    public void setKtPrintMainItem(Long ktPrintMainItem) {
        this.ktPrintMainItem = ktPrintMainItem;
    }

    public void setKtShowPrice(Long ktShowPrice) {
        this.ktShowPrice = ktShowPrice;
    }

    public void setKtFont(Long ktFont) {
        this.ktFont = ktFont;
    }

    public void setConditions(Long conditions) {
        this.conditions = conditions;
    }

    public void setIsRt(Long isRt) {
        this.isRt = isRt;
    }

    public void setVisible(Byte visible) {
        this.visible = visible;
    }

    public void setDeletes(Long deletes) {
        this.deletes = deletes;
    }

    public void setIsStatistic(Long isStatistic) {
        this.isStatistic = isStatistic;
    }

    public void setFid(long fid) {
        this.fid = fid;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public void setBgColor(int bgColor) {
        this.bgColor = bgColor;
    }

    public void setFontColor(int fontColor) {
        this.fontColor = fontColor;
    }

    public void setMaxNumber(String maxNumber) {
        this.maxNumber = maxNumber;
    }

    public boolean isSoldout() {
        return isSoldout;
    }

    public void setSoldout(boolean soldout) {
        isSoldout = soldout;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public void setReturn(boolean aReturn) {
        isReturn = aReturn;
    }

    public String getPId() {
        return this.pId;
    }

    public void setPId(String pId) {
        this.pId = pId;
    }

    public String getDefmodifier() {
        return defmodifier;
    }

    public void setDefmodifier(String defmodifier) {
        this.defmodifier = defmodifier;
    }

    public void setDbid(long dbid) {
        this.dbid = dbid;
    }

    public void setMid(long mid) {
        this.mid = mid;
    }

    public void setTopId(long topId) {
        this.topId = topId;
    }

    public void setRestaurantId(long restaurantId) {
        this.restaurantId = restaurantId;
    }

    public void setSeqNo(long seqNo) {
        this.seqNo = seqNo;
    }

    public void setMarketPrice(double marketPrice) {
        this.marketPrice = marketPrice;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public void setLunchboxPrice(double lunchboxPrice) {
        this.lunchboxPrice = lunchboxPrice;
    }

    public void setColorId(long colorId) {
        this.colorId = colorId;
    }

    public void setInvisible(long invisible) {
        this.invisible = invisible;
    }

    public void setCost(double cost) {
        this.cost = cost;
    }

    public void setLike(long like) {
        this.like = like;
    }

    public void setTotalSold(long totalSold) {
        this.totalSold = totalSold;
    }

    public void setMajorMainId(long majorMainId) {
        this.majorMainId = majorMainId;
    }

    public void setDeptId(long deptId) {
        this.deptId = deptId;
    }

    public void setAutoMod(long autoMod) {
        this.autoMod = autoMod;
    }

    public void setBlueEdit(long blueEdit) {
        this.blueEdit = blueEdit;
    }

    public void setAutoMerge(long autoMerge) {
        this.autoMerge = autoMerge;
    }

    public void setCustomMsg(long customMsg) {
        this.customMsg = customMsg;
    }

    public void setIsParent(long isParent) {
        this.isParent = isParent;
    }

    public void setMultiple(double multiple) {
        this.multiple = multiple;
    }

    public void setModComm(long modComm) {
        this.modComm = modComm;
    }

    public void setModTaste(long modTaste) {
        this.modTaste = modTaste;
    }

    public void setModMsg(long modMsg) {
        this.modMsg = modMsg;
    }

    public void setKtFireCourse(long ktFireCourse) {
        this.ktFireCourse = ktFireCourse;
    }

    public void setAbleDisCount(long ableDisCount) {
        this.ableDisCount = ableDisCount;
    }

    public void setPrintToBill(long printToBill) {
        this.printToBill = printToBill;
    }

    public void setKtPrintMainItem(long ktPrintMainItem) {
        this.ktPrintMainItem = ktPrintMainItem;
    }

    public void setKtShowPrice(long ktShowPrice) {
        this.ktShowPrice = ktShowPrice;
    }

    public void setKtFont(long ktFont) {
        this.ktFont = ktFont;
    }

    public void setConditions(long conditions) {
        this.conditions = conditions;
    }

    public void setIsRt(long isRt) {
        this.isRt = isRt;
    }

    public void setVisible(byte visible) {
        this.visible = visible;
    }

    public void setDeletes(long deletes) {
        this.deletes = deletes;
    }

    public void setIsStatistic(long isStatistic) {
        this.isStatistic = isStatistic;
    }

    public int getSelectQty() {
        return selectQty;
    }

    public void setSelectQty(int selectQty) {
        this.selectQty = selectQty;
    }

    /** To-one relationship, resolved on first access. */
    @Generated(hash = 972194621)
    public ColorBean getColorBean() {
        long __key = this.colorId;
        if (colorBean__resolvedKey == null || !colorBean__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ColorBeanDao targetDao = daoSession.getColorBeanDao();
            ColorBean colorBeanNew = targetDao.load(__key);
            synchronized (this) {
                colorBean = colorBeanNew;
                colorBean__resolvedKey = __key;
            }
        }
        return colorBean;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 453682256)
    public void setColorBean(@NotNull ColorBean colorBean) {
        if (colorBean == null) {
            throw new DaoException("To-one property 'colorId' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this) {
            this.colorBean = colorBean;
            colorId = colorBean.getColorId();
            colorBean__resolvedKey = colorId;
        }
    }

    /**
     * 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 = 956718133)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getModifierDao() : null;
    }
}
