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

import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.common.utils.SysUtil;
import com.bonus.canteen.core.menu.constant.MenuSalesTypeEnum;
import com.bonus.canteen.core.menu.utils.CustomUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
import java.util.Optional;

@ApiModel
public class MenuDishesV2AddDTO {
   @ApiModelProperty("类型(1-菜品,2-套餐)")
   private @NotNull(
   message = "{menu_meal_type_null}"
) Integer mealType;
   @ApiModelProperty("区域id")
   private Long areaId;
   @ApiModelProperty("食堂id")
   private Long canteenId;
   @ApiModelProperty("档口id")
   private Long shopstallId;
   @ApiModelProperty("是否是公共菜品(1-是,2-否,)")
   private Integer publicDishes;
   @ApiModelProperty("菜品编号")
   private String dishesNum;
   @ApiModelProperty("菜品名称")
   private String dishesName;
   @ApiModelProperty("计价方式(1按份,2称重)")
   private Integer salesMode;
   @ApiModelProperty("规格类型(1-标准,2-大小份)")
   private Long sizeType;
   @ApiModelProperty("称重单位(g)")
   private Integer unitPrice;
   @ApiModelProperty("菜品基础单价(分)")
   private Integer price;
   @ApiModelProperty("大份单价")
   private Integer largePrice;
   @ApiModelProperty("小份单价")
   private Integer littlePrice;
   @ApiModelProperty("标准份量")
   private Double weight;
   @ApiModelProperty("大份份量")
   private Double largeWeight;
   @ApiModelProperty("小份份量")
   private Double littleWeight;
   @ApiModelProperty("菜品灶类id")
   private Long cookId;
   @ApiModelProperty("标签id")
   private List<Long> labelIdList;
   @ApiModelProperty("口味id")
   private @Size(
   max = 3,
   message = "口味最多配置3个"
) List<Long> tasteIdList;
   @ApiModelProperty("辣度")
   private Integer pungencyDegree;
   @ApiModelProperty("菜系")
   private Long styleId;
   @ApiModelProperty("功效")
   private Long effectId;
   @ApiModelProperty("适宜人群")
   private List<Long> suitIdList;
   @ApiModelProperty("菜品简介")
   private String intro;
   @ApiModelProperty("菜品类型id")
   private Long typeId;
   @ApiModelProperty("菜品图片url")
   private String imageUrl;
   @ApiModelProperty("质量偏差(g)")
   private Double weightDeviation;
   @ApiModelProperty("成本价")
   private Integer materialCost;
   @ApiModelProperty("成本价-小份")
   private Integer littleMaterialCost;
   @ApiModelProperty("结果图转注册图 1 是  2否")
   private Integer convertFlag;
   @ApiModelProperty("结果图转注册图 1 是  2否")
   private Integer littleConvertFlag;
   @ApiModelProperty("原材料")
   private @Valid List<MenuDishesAddMaterialDTO> materialList;
   @ApiModelProperty("小份原料组成")
   private @Valid List<MenuDishesAddMaterialDTO> littleMaterialList;
   @ApiModelProperty("套餐菜品")
   private @Valid List<MenuPackageDishesAddDTO> packageDishesList;
   @ApiModelProperty("季节分类")
   private List<Long> season;
   @ApiModelProperty("季节分类")
   private List<Integer> mealtimeTypes;

   public Integer getSalesMode() {
      if (ObjectUtil.isNull(this.salesMode)) {
         this.salesMode = MenuSalesTypeEnum.PORTION_ON.key();
      }

      return this.salesMode;
   }

   public Long getSizeType() {
      return (Long)Optional.ofNullable(this.sizeType).orElse(1L);
   }

   public String getImageUrl() {
      if (!CharSequenceUtil.isNotBlank(this.imageUrl)) {
         return this.imageUrl;
      } else {
         String[] split = this.imageUrl.split(",");
         StringBuilder newImageUrl = new StringBuilder();
         String[] var3 = split;
         int var4 = split.length;

         for(int var5 = 0; var5 < var4; ++var5) {
            String s = var3[var5];
            newImageUrl.append(SysUtil.getCutPath(s)).append(",");
         }

         return newImageUrl.substring(0, newImageUrl.length() - 1);
      }
   }

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

   public Long getCanteenId() {
      return (Long)Optional.ofNullable(this.canteenId).orElse(-1L);
   }

   public Integer getMaterialCost() {
      return (Integer)Optional.ofNullable(this.materialCost).orElse(0);
   }

   public Integer getLittleMaterialCost() {
      return (Integer)Optional.ofNullable(this.littleMaterialCost).orElse(0);
   }

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

   public Long getAreaId() {
      return this.areaId;
   }

   public Long getShopstallId() {
      return this.shopstallId;
   }

   public Integer getPublicDishes() {
      return this.publicDishes;
   }

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

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

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

   public Integer getLargePrice() {
      return this.largePrice;
   }

   public Integer getLittlePrice() {
      return this.littlePrice;
   }

   public Double getWeight() {
      return this.weight;
   }

   public Double getLargeWeight() {
      return this.largeWeight;
   }

   public Double getLittleWeight() {
      return this.littleWeight;
   }

   public Long getCookId() {
      return this.cookId;
   }

   public List<Long> getLabelIdList() {
      return this.labelIdList;
   }

   public List<Long> getTasteIdList() {
      return this.tasteIdList;
   }

   public Integer getPungencyDegree() {
      return this.pungencyDegree;
   }

   public Long getStyleId() {
      return this.styleId;
   }

   public Long getEffectId() {
      return this.effectId;
   }

   public List<Long> getSuitIdList() {
      return this.suitIdList;
   }

   public String getIntro() {
      return this.intro;
   }

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

   public Double getWeightDeviation() {
      return this.weightDeviation;
   }

   public Integer getConvertFlag() {
      return this.convertFlag;
   }

   public Integer getLittleConvertFlag() {
      return this.littleConvertFlag;
   }

   public List<MenuDishesAddMaterialDTO> getMaterialList() {
      return this.materialList;
   }

   public List<MenuDishesAddMaterialDTO> getLittleMaterialList() {
      return this.littleMaterialList;
   }

   public List<MenuPackageDishesAddDTO> getPackageDishesList() {
      return this.packageDishesList;
   }

   public List<Long> getSeason() {
      return this.season;
   }

   public List<Integer> getMealtimeTypes() {
      return this.mealtimeTypes;
   }

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

   public void setAreaId(final Long areaId) {
      this.areaId = areaId;
   }

   public void setCanteenId(final Long canteenId) {
      this.canteenId = canteenId;
   }

   public void setShopstallId(final Long shopstallId) {
      this.shopstallId = shopstallId;
   }

   public void setPublicDishes(final Integer publicDishes) {
      this.publicDishes = publicDishes;
   }

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

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

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

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

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

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

   public void setLargePrice(final Integer largePrice) {
      this.largePrice = largePrice;
   }

   public void setLittlePrice(final Integer littlePrice) {
      this.littlePrice = littlePrice;
   }

   public void setWeight(final Double weight) {
      this.weight = weight;
   }

   public void setLargeWeight(final Double largeWeight) {
      this.largeWeight = largeWeight;
   }

   public void setLittleWeight(final Double littleWeight) {
      this.littleWeight = littleWeight;
   }

   public void setCookId(final Long cookId) {
      this.cookId = cookId;
   }

   public void setLabelIdList(final List<Long> labelIdList) {
      this.labelIdList = labelIdList;
   }

   public void setTasteIdList(final List<Long> tasteIdList) {
      this.tasteIdList = tasteIdList;
   }

   public void setPungencyDegree(final Integer pungencyDegree) {
      this.pungencyDegree = pungencyDegree;
   }

   public void setStyleId(final Long styleId) {
      this.styleId = styleId;
   }

   public void setEffectId(final Long effectId) {
      this.effectId = effectId;
   }

   public void setSuitIdList(final List<Long> suitIdList) {
      this.suitIdList = suitIdList;
   }

   public void setIntro(final String intro) {
      this.intro = intro;
   }

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

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

   public void setWeightDeviation(final Double weightDeviation) {
      this.weightDeviation = weightDeviation;
   }

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

   public void setLittleMaterialCost(final Integer littleMaterialCost) {
      this.littleMaterialCost = littleMaterialCost;
   }

   public void setConvertFlag(final Integer convertFlag) {
      this.convertFlag = convertFlag;
   }

   public void setLittleConvertFlag(final Integer littleConvertFlag) {
      this.littleConvertFlag = littleConvertFlag;
   }

   public void setMaterialList(final List<MenuDishesAddMaterialDTO> materialList) {
      this.materialList = materialList;
   }

   public void setLittleMaterialList(final List<MenuDishesAddMaterialDTO> littleMaterialList) {
      this.littleMaterialList = littleMaterialList;
   }

   public void setPackageDishesList(final List<MenuPackageDishesAddDTO> packageDishesList) {
      this.packageDishesList = packageDishesList;
   }

   public void setSeason(final List<Long> season) {
      this.season = season;
   }

   public void setMealtimeTypes(final List<Integer> mealtimeTypes) {
      this.mealtimeTypes = mealtimeTypes;
   }
}
