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.Id;
import org.greenrobot.greendao.annotation.Property;

import java.util.Date;

import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Transient;

/**
 * 作者：ELEGANT_BIN
 * 版本：1.6.0
 * 创建日期：2020-02-18
 * 修订历史：2020-02-18
 * 描述：套餐食品關係
 */
@Entity
public class ComboItem {

    /**
     * ID
     */
//    @Property(nameInDb = "_id")
//    @Id(autoincrement = true)
//    private Long id;
//
//    private Long comId;
//
//    private Long fid;
//
//    private Long qty;
//
//    private Double diffAmt;
//
//    private Long seqNo;
//
//    private Long visible;
//
//    private Date createTime;
//
//    private String createBy;
//
//    private Date updateTime;
//
//    private Long conditions;
//
//    private Long isRT;
//
//    private Byte deletes;
//
//    private Long posId;
//
//    private Long restaurant_id;
//
//    private Byte isMainAccount;

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

    private long comId;

    private long fid;

    private long qty;

    private double diffAmt;

    private long seqNo;

    private long visible;

    private Date createTime;

    private String createBy;

    private Date updateTime;

    private long conditions;

    private long isRT;

    private byte deletes;

    private long posId;

    private long restaurant_id;

    private byte isMainAccount;

    /**
     * 自定義字段
     */
    @Transient
    private String name;
    @Transient
    private String name1;
    @Transient
    private String name2;
    @Transient
    private long parentId;
    /**
     * 套餐最大選擇數
     */
    @Transient
    private int selectQty = 0;
    /**
     * 默認選中數
     */
    @Transient
    private String defmodifier = "0";
    /**
     * 價格
     */
    @Transient
    private double price = 0.00;
    /*** 是否自動展開*/
    @Transient
    private int autoMode = 0;
    /*** 是否备注细项*/
    @Transient
    private boolean isModifier;
    /**
     * 0=顯示, 1=隱藏, 2=暫停,3=只显示,不操作
     */
    @Transient
    private long invisible;
    @Transient
    /**最大選中數*/
    private String maxNumber = "";
    /**動態的最大選中數*/
    @Transient
    private String currentMaxNumber= "";
    /*** 背景顏色*/
    @Transient
    private int bgColor = Color.parseColor("#067878");
    /*** 字體顏色*/
    @Transient
    private int fontColor = Color.parseColor("#FFFFFF");
    /*** 套餐細項*/
    @Transient
    private Modifier modifier;


    @Generated(hash = 1123579083)
    public ComboItem(Long id, long comId, long fid, long qty, double diffAmt, long seqNo, long visible, Date createTime,
            String createBy, Date updateTime, long conditions, long isRT, byte deletes, long posId, long restaurant_id,
            byte isMainAccount) {
        this.id = id;
        this.comId = comId;
        this.fid = fid;
        this.qty = qty;
        this.diffAmt = diffAmt;
        this.seqNo = seqNo;
        this.visible = visible;
        this.createTime = createTime;
        this.createBy = createBy;
        this.updateTime = updateTime;
        this.conditions = conditions;
        this.isRT = isRT;
        this.deletes = deletes;
        this.posId = posId;
        this.restaurant_id = restaurant_id;
        this.isMainAccount = isMainAccount;
    }

    @Generated(hash = 435228340)
    public ComboItem() {
    }


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

    public Long getId() {
        return id;
    }

    public Long getComId() {
        return comId;
    }

    public Long getFid() {
        return fid;
    }

    public long getInvisible() {
        return invisible;
    }

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

    public String getMaxNumber() {
        return maxNumber;
    }

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

    public String getCurrentMaxNumber() {
        return currentMaxNumber;
    }

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


    public Long getQty() {
        return qty;
    }

    public Double getDiffAmt() {
        return diffAmt;
    }

    public Long getSeqNo() {
        return seqNo;
    }

    public Long getVisible() {
        return visible;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public String getCreateBy() {
        return createBy;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public Long getConditions() {
        return conditions;
    }

    public Long getIsRT() {
        return isRT;
    }

    public Byte getDeletes() {
        return deletes;
    }

    public Long getPosId() {
        return posId;
    }

    public Long getRestaurant_id() {
        return restaurant_id;
    }

    public Byte getIsMainAccount() {
        return isMainAccount;
    }

    public String getName() {
        return name;
    }

    public String getName1() {
        return name1;
    }

    public String getName2() {
        return name2;
    }

    public long getParentId() {
        return parentId;
    }

    public double getPrice() {
        return price;
    }

    public int getAutoMode() {
        return autoMode;
    }

    public boolean isModifier() {
        return isModifier;
    }

    public int getBgColor() {
        return bgColor;
    }

    public int getFontColor() {
        return fontColor;
    }

    public void setName1(String name1) {
        this.name1 = name1;
    }

    public void setName2(String name2) {
        this.name2 = name2;
    }

    public Modifier getModifier() {
        return modifier;
    }

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

    public void setComId(Long comId) {
        this.comId = comId;
    }

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

    public void setQty(Long qty) {
        this.qty = qty;
    }

    public void setDiffAmt(Double diffAmt) {
        this.diffAmt = diffAmt;
    }

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

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

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

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

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

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

    public void setIsRT(Long isRT) {
        this.isRT = isRT;
    }

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

    public void setPosId(Long posId) {
        this.posId = posId;
    }

    public void setRestaurant_id(Long restaurant_id) {
        this.restaurant_id = restaurant_id;
    }

    public void setIsMainAccount(Byte isMainAccount) {
        this.isMainAccount = isMainAccount;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setParentId(long parentId) {
        this.parentId = parentId;
    }

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

    public void setAutoMode(int autoMode) {
        this.autoMode = autoMode;
    }

    public void setModifier(boolean modifier) {
        isModifier = modifier;
    }

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

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

    public void setModifier(Modifier modifier) {
        this.modifier = modifier;
    }

    public int getSelectQty() {
        return selectQty;
    }

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

    public String getDefmodifier() {
        return defmodifier;
    }

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

    public static ComboItem addFoodInfo(Food food, ComboItem foodCombo) {
        foodCombo.setName(food.getFoodName());
        foodCombo.setFid(food.getId());
        foodCombo.setPrice(food.getPrice());
        foodCombo.setAutoMode(food.getAutoMod());
        return foodCombo;
    }

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

    public void setComId(long comId) {
        this.comId = comId;
    }

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

    public void setQty(long qty) {
        this.qty = qty;
    }

    public void setDiffAmt(double diffAmt) {
        this.diffAmt = diffAmt;
    }

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

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

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

    public void setIsRT(long isRT) {
        this.isRT = isRT;
    }

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

    public void setPosId(long posId) {
        this.posId = posId;
    }

    public void setRestaurant_id(long restaurant_id) {
        this.restaurant_id = restaurant_id;
    }

    public void setIsMainAccount(byte isMainAccount) {
        this.isMainAccount = isMainAccount;
    }

}
