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

import android.graphics.Color;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.JoinEntity;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Transient;
import org.greenrobot.greendao.annotation.Generated;

import java.util.List;

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

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

    private Long fid; //食品ID
    private int comId;//套餐ID

//    @ToMany
//    @JoinEntity(entity = ComboItem.class, sourceProperty = "comId", targetProperty = "fid")
//    private List<ComboItem> comboItems;
    /**
     * 自定義字段
     */
    @Transient
    private String name;
    @Transient
    private long parentId;
    /**
     * 價格
     */
    @Transient
    private double price = 0.00;
    /**
     * 是否自動展開
     */
    @Transient
    private int autoMode = 0;
    /**
     * 是否备注细项
     */
    @Transient
    private boolean isModifier;
    /**
     * 背景顏色
     */
    @Transient
    private int bgColor = Color.parseColor("#067878");
    /**
     * 字體顏色
     */
    @Transient
    private int fontColor = Color.parseColor("#FFFFFF");
    /**
     * 套餐細項
     */
    @Transient
    private Modifier modifier;



    @Generated(hash = 34188725)
    public FoodCombo(Long id, Long fid, int comId) {
        this.id = id;
        this.fid = fid;
        this.comId = comId;
    }

    @Generated(hash = 1913989231)
    public FoodCombo() {
    }



    public long getParentId() {
        return parentId;
    }

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

    public Long getId() {
        return id;
    }

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

    public Long getFid() {
        return fid;
    }

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

    public int getComId() {
        return comId;
    }

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

    public String getName() {
        return name;
    }

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

    public int getAutoMode() {
        return autoMode;
    }

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

    public double getPrice() {
        return price;
    }

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

    public boolean isModifier() {
        return isModifier;
    }

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

    public int getBgColor() {
        return bgColor;
    }

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

    public int getFontColor() {
        return fontColor;
    }

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

    public Modifier getModifier() {
        return modifier;
    }

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

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

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

}
