package com.bonus.canteen.core.menu.vo;

import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.menu.enums.MenuSalesTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;

import java.io.Serializable;

@ApiModel("菜品详情")
public class MenuRecipeDetailDishesVO implements Serializable {
   private Long id;
   @ApiModelProperty("菜品id")
   private Long dishesId;

   @Getter
   @ApiModelProperty("菜品基础id")
   private long baseDishesId;


   @ApiModelProperty("菜品名称")
   private String dishesName;
   @ApiModelProperty("菜品编号")
   private String dishesNum;
   @ApiModelProperty("菜品类型")
   private Integer mealType;
   @ApiModelProperty("成本价")
   private Integer materialCost;
   @ApiModelProperty("价格")
   private Integer price;
   @ApiModelProperty("规格类型(1-标准,2-大份,3-小份,4-50g,5-100g)")
   private Long sizeType;
   @ApiModelProperty("供应数量")
   private Integer supplyNum;
   @ApiModelProperty("销售数量")
   private Integer saleNum;
   @ApiModelProperty("剩余数量")
   private Integer surplusNum;
   @ApiModelProperty("个人限购数量")
   private Integer restrictNum;
   @ApiModelProperty("菜品价格(优惠价)")
   private Integer salePrice;
   @ApiModelProperty("是否推荐")
   private Integer recommendFlag;
   @ApiModelProperty("排序号")
   private Integer sortNum;
   @ApiModelProperty("类别名称")
   private String typeName;
   @ApiModelProperty("类别id")
   private Long typeId;
   @ApiModelProperty("食堂名称")
   private String canteenName;
   @ApiModelProperty("销售方式(1按份,2称重)")
   private Integer salesMode;
   @ApiModelProperty("称重单位多少克(默认1kg)")
   private Integer unitPrice;


   public void setBaseDishesId(long baseDishesId) {
      this.baseDishesId = baseDishesId;
   }

   public Long getSizeType() {
      if (ObjectUtil.isNull(this.sizeType)) {
         if (MenuSalesTypeEnum.PORTION_ON.key().equals(this.salesMode)) {
            return 1L;
         } else {
            return this.unitPrice == 50 ? 4L : 5L;
         }
      } else {
         return this.sizeType;
      }
   }

   public Long getId() {
      return this.id;
   }

   public Long getDishesId() {
      return this.dishesId;
   }

   public String getDishesName() {
      return this.dishesName;
   }

   public String getDishesNum() {
      return this.dishesNum;
   }

   public Integer getMealType() {
      return this.mealType;
   }

   public Integer getMaterialCost() {
      return this.materialCost;
   }

   public Integer getPrice() {
      return this.price;
   }

   public Integer getSupplyNum() {
      return this.supplyNum;
   }

   public Integer getSaleNum() {
      return this.saleNum;
   }

   public Integer getSurplusNum() {
      return this.surplusNum;
   }

   public Integer getRestrictNum() {
      return this.restrictNum;
   }

   public Integer getSalePrice() {
      return this.salePrice;
   }

   public Integer getRecommendFlag() {
      return this.recommendFlag;
   }

   public Integer getSortNum() {
      return this.sortNum;
   }

   public String getTypeName() {
      return this.typeName;
   }

   public Long getTypeId() {
      return this.typeId;
   }

   public String getCanteenName() {
      return this.canteenName;
   }

   public Integer getSalesMode() {
      return this.salesMode;
   }

   public Integer getUnitPrice() {
      return this.unitPrice;
   }

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

   public void setDishesId(final Long dishesId) {
      this.dishesId = dishesId;
   }

   public void setDishesName(final String dishesName) {
      this.dishesName = dishesName;
   }

   public void setDishesNum(final String dishesNum) {
      this.dishesNum = dishesNum;
   }

   public void setMealType(final Integer mealType) {
      this.mealType = mealType;
   }

   public void setMaterialCost(final Integer materialCost) {
      this.materialCost = materialCost;
   }

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

   public void setSizeType(final Long sizeType) {
      this.sizeType = sizeType;
   }

   public void setSupplyNum(final Integer supplyNum) {
      this.supplyNum = supplyNum;
   }

   public void setSaleNum(final Integer saleNum) {
      this.saleNum = saleNum;
   }

   public void setSurplusNum(final Integer surplusNum) {
      this.surplusNum = surplusNum;
   }

   public void setRestrictNum(final Integer restrictNum) {
      this.restrictNum = restrictNum;
   }

   public void setSalePrice(final Integer salePrice) {
      this.salePrice = salePrice;
   }

   public void setRecommendFlag(final Integer recommendFlag) {
      this.recommendFlag = recommendFlag;
   }

   public void setSortNum(final Integer sortNum) {
      this.sortNum = sortNum;
   }

   public void setTypeName(final String typeName) {
      this.typeName = typeName;
   }

   public void setTypeId(final Long typeId) {
      this.typeId = typeId;
   }

   public void setCanteenName(final String canteenName) {
      this.canteenName = canteenName;
   }

   public void setSalesMode(final Integer salesMode) {
      this.salesMode = salesMode;
   }

   public void setUnitPrice(final Integer unitPrice) {
      this.unitPrice = unitPrice;
   }

}
