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

import com.bonus.canteen.core.menu.constant.MenuSalesTypeEnum;
import com.bonus.canteen.core.menu.utils.CustomUtil;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;
import java.util.Optional;

public class AndroidAddRecipeDishesDetailDTO {
   @ApiModelProperty("菜品类型id")
   private Long typeId;
   @ApiModelProperty("菜品id")
   private Long dishesId;
   @ApiModelProperty("菜品名称")
   private String dishesName;
   @ApiModelProperty("菜品价格")
   private @NotNull(
   message = "{menu_price_null}"
) Integer price;
   @ApiModelProperty("供应数量")
   private @NotNull(
   message = "{menu_supply_num_null}"
) Integer supplyNum;
   @ApiModelProperty("个人限购数量")
   private @NotNull(
   message = "{menu_restrict_num_null}"
) Integer restrictNum;
   @ApiModelProperty("菜品图片")
   private String picUrl;
   @ApiModelProperty("计价方式(1按份,2称重)")
   private Integer salesMode;
   @ApiModelProperty("标准份量")
   private Double weight;
   @ApiModelProperty("称重单位(g)")
   private Integer unitPrice;
   @ApiModelProperty("质量偏差(g)")
   private Double weightDeviation;

   public Integer getPrice() {
      return (Integer)Optional.ofNullable(this.price).orElse(0);
   }

   public Integer getSalesMode() {
      return (Integer)Optional.ofNullable(this.salesMode).orElse(MenuSalesTypeEnum.PORTION_ON.key());
   }

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

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

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

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

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

   public String getPicUrl() {
      return this.picUrl;
   }

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

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

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

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

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

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

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

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

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

   public void setPicUrl(final String picUrl) {
      this.picUrl = picUrl;
   }

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

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

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

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

}
