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

import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.bonus.canteen.core.menu.enums.BigDecimalSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Optional;

@ApiModel("下发菜谱")
public class IssueRecipeMealCompressVO implements Serializable {
   @ApiModelProperty("菜品id")
   private Long dishesId;
   @ApiModelProperty("自定义id")
   private Integer customId;
   @ApiModelProperty("菜品名称")
   private String productName;
   @ApiModelProperty("原价")
   private Integer originalPrice;
   @ApiModelProperty("销售模式")
   private Integer salseMode;
   @ApiModelProperty("质量偏差(g)")
   private BigDecimal weightDeviation;
   @ApiModelProperty("每份重量")
   private BigDecimal weight;
   @ApiModelProperty("菜品类型id")
   private Long typeId;
   @ApiModelProperty("菜品类型名称")
   private String typeName;
   @ApiModelProperty("菜品名称首字母")
   private String pinyinInitials;
   @ApiModelProperty("菜品名称全拼")
   private String pinyinFull;
   @ApiModelProperty("总嘌呤含量(mg/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal purine;
   @ApiModelProperty("碘(μg/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal iodine;
   @ApiModelProperty("菜品初始推荐分值")
   private Integer initialScore;
   @ApiModelProperty("热量(千卡/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal calories;
   @ApiModelProperty("蛋白质(g/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal protein;
   @ApiModelProperty("脂肪(g/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal fat;
   @ApiModelProperty("碳水化合物(g/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal carbohydrate;
   @ApiModelProperty("膳食纤维(g/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal dietaryFiber;
   @ApiModelProperty("胆固醇(mg/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal cholesterol;
   @ApiModelProperty("钙(mg/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal calcium;
   @ApiModelProperty("钠(mg/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal sodium;
   @ApiModelProperty("热量NRV(千卡/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal caloriesNrv;
   @ApiModelProperty("蛋白质NRV(g/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal proteinNrv;
   @ApiModelProperty("脂肪NRV(g/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal fatNrv;
   @ApiModelProperty("碳水化合物NRV(g/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal carbohydrateNrv;
   @ApiModelProperty("膳食纤维NRV(g/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal dietaryFiberNrv;
   @ApiModelProperty("胆固醇NRV(mg/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal cholesterolNrv;
   @ApiModelProperty("钙NRV(mg/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal calciumNrv;
   @ApiModelProperty("钠NRV(mg/100g)")
   @JsonSerialize(
      using = BigDecimalSerializer.class
   )
   private BigDecimal sodiumNrv;
   @ApiModelProperty("菜品图片")
   private String foodImage;
   @ApiModelProperty("菜品简介")
   private String intro;
   @ApiModelProperty("菜品标签")
   private List<String> labelList;
   @ApiModelProperty("菜品主料")
   private List<String> mainList;
   @ApiModelProperty("菜品辅料")
   private List<String> auxList;
   @ApiModelProperty("菜品配料")
   private List<String> dosList;
   @ApiModelProperty("月销量")
   private Integer monthlySales;
   @ApiModelProperty("好评率")
   private BigDecimal goodProbability;

   public String getFoodImage() {
      return FileUrlUtil.getFileUrl(this.foodImage);
   }

   public BigDecimal getWeightDeviation() {
      return ObjectUtil.isNull(this.weightDeviation) ? BigDecimal.ZERO : this.weightDeviation.setScale(0, RoundingMode.HALF_UP);
   }

   public BigDecimal getWeight() {
      return ObjectUtil.isNull(this.weight) ? BigDecimal.ZERO : this.weight.setScale(0, RoundingMode.HALF_UP);
   }

   public BigDecimal getCaloriesNrv() {
      return !ObjectUtil.isNull(this.weight) && !NumberUtil.equals(this.weight, BigDecimal.ZERO) ? ((BigDecimal)Optional.ofNullable(this.calories).orElse(BigDecimal.ZERO)).divide(this.weight, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("4.185")).divide(new BigDecimal("8400"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
   }

   public BigDecimal getProteinNrv() {
      return !ObjectUtil.isNull(this.weight) && !NumberUtil.equals(this.weight, BigDecimal.ZERO) ? ((BigDecimal)Optional.ofNullable(this.protein).orElse(BigDecimal.ZERO)).divide(this.weight, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).divide(new BigDecimal("60"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
   }

   public BigDecimal getFatNrv() {
      return !ObjectUtil.isNull(this.weight) && !NumberUtil.equals(this.weight, BigDecimal.ZERO) ? ((BigDecimal)Optional.ofNullable(this.fat).orElse(BigDecimal.ZERO)).divide(this.weight, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).divide(new BigDecimal("60"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
   }

   public BigDecimal getCarbohydrateNrv() {
      return !ObjectUtil.isNull(this.weight) && !NumberUtil.equals(this.weight, BigDecimal.ZERO) ? ((BigDecimal)Optional.ofNullable(this.carbohydrate).orElse(BigDecimal.ZERO)).divide(this.weight, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).divide(new BigDecimal("300"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
   }

   public BigDecimal getDietaryFiberNrv() {
      return !ObjectUtil.isNull(this.weight) && !NumberUtil.equals(this.weight, BigDecimal.ZERO) ? ((BigDecimal)Optional.ofNullable(this.dietaryFiber).orElse(BigDecimal.ZERO)).divide(this.weight, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).divide(new BigDecimal("25"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
   }

   public BigDecimal getCholesterolNrv() {
      return !ObjectUtil.isNull(this.weight) && !NumberUtil.equals(this.weight, BigDecimal.ZERO) ? ((BigDecimal)Optional.ofNullable(this.cholesterol).orElse(BigDecimal.ZERO)).divide(this.weight, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).divide(new BigDecimal("300"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
   }

   public BigDecimal getCalciumNrv() {
      return !ObjectUtil.isNull(this.weight) && !NumberUtil.equals(this.weight, BigDecimal.ZERO) ? ((BigDecimal)Optional.ofNullable(this.calcium).orElse(BigDecimal.ZERO)).divide(this.weight, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).divide(new BigDecimal("800"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
   }

   public BigDecimal getSodiumNrv() {
      return !ObjectUtil.isNull(this.weight) && !NumberUtil.equals(this.weight, BigDecimal.ZERO) ? ((BigDecimal)Optional.ofNullable(this.sodium).orElse(BigDecimal.ZERO)).divide(this.weight, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).divide(new BigDecimal("2000"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
   }

   public Integer getMonthlySales() {
      return (Integer)Optional.ofNullable(this.monthlySales).orElse(0);
   }

   public BigDecimal getGoodProbability() {
      return (BigDecimal)Optional.ofNullable(this.goodProbability).orElse(BigDecimal.ZERO);
   }

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

   public Integer getCustomId() {
      return this.customId;
   }

   public String getProductName() {
      return this.productName;
   }

   public Integer getOriginalPrice() {
      return this.originalPrice;
   }

   public Integer getSalseMode() {
      return this.salseMode;
   }

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

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

   public String getPinyinInitials() {
      return this.pinyinInitials;
   }

   public String getPinyinFull() {
      return this.pinyinFull;
   }

   public BigDecimal getPurine() {
      return this.purine;
   }

   public BigDecimal getIodine() {
      return this.iodine;
   }

   public Integer getInitialScore() {
      return this.initialScore;
   }

   public BigDecimal getCalories() {
      return this.calories;
   }

   public BigDecimal getProtein() {
      return this.protein;
   }

   public BigDecimal getFat() {
      return this.fat;
   }

   public BigDecimal getCarbohydrate() {
      return this.carbohydrate;
   }

   public BigDecimal getDietaryFiber() {
      return this.dietaryFiber;
   }

   public BigDecimal getCholesterol() {
      return this.cholesterol;
   }

   public BigDecimal getCalcium() {
      return this.calcium;
   }

   public BigDecimal getSodium() {
      return this.sodium;
   }

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

   public List<String> getLabelList() {
      return this.labelList;
   }

   public List<String> getMainList() {
      return this.mainList;
   }

   public List<String> getAuxList() {
      return this.auxList;
   }

   public List<String> getDosList() {
      return this.dosList;
   }

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

   public void setCustomId(final Integer customId) {
      this.customId = customId;
   }

   public void setProductName(final String productName) {
      this.productName = productName;
   }

   public void setOriginalPrice(final Integer originalPrice) {
      this.originalPrice = originalPrice;
   }

   public void setSalseMode(final Integer salseMode) {
      this.salseMode = salseMode;
   }

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

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

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

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

   public void setPinyinInitials(final String pinyinInitials) {
      this.pinyinInitials = pinyinInitials;
   }

   public void setPinyinFull(final String pinyinFull) {
      this.pinyinFull = pinyinFull;
   }

   public void setPurine(final BigDecimal purine) {
      this.purine = purine;
   }

   public void setIodine(final BigDecimal iodine) {
      this.iodine = iodine;
   }

   public void setInitialScore(final Integer initialScore) {
      this.initialScore = initialScore;
   }

   public void setCalories(final BigDecimal calories) {
      this.calories = calories;
   }

   public void setProtein(final BigDecimal protein) {
      this.protein = protein;
   }

   public void setFat(final BigDecimal fat) {
      this.fat = fat;
   }

   public void setCarbohydrate(final BigDecimal carbohydrate) {
      this.carbohydrate = carbohydrate;
   }

   public void setDietaryFiber(final BigDecimal dietaryFiber) {
      this.dietaryFiber = dietaryFiber;
   }

   public void setCholesterol(final BigDecimal cholesterol) {
      this.cholesterol = cholesterol;
   }

   public void setCalcium(final BigDecimal calcium) {
      this.calcium = calcium;
   }

   public void setSodium(final BigDecimal sodium) {
      this.sodium = sodium;
   }

   public void setCaloriesNrv(final BigDecimal caloriesNrv) {
      this.caloriesNrv = caloriesNrv;
   }

   public void setProteinNrv(final BigDecimal proteinNrv) {
      this.proteinNrv = proteinNrv;
   }

   public void setFatNrv(final BigDecimal fatNrv) {
      this.fatNrv = fatNrv;
   }

   public void setCarbohydrateNrv(final BigDecimal carbohydrateNrv) {
      this.carbohydrateNrv = carbohydrateNrv;
   }

   public void setDietaryFiberNrv(final BigDecimal dietaryFiberNrv) {
      this.dietaryFiberNrv = dietaryFiberNrv;
   }

   public void setCholesterolNrv(final BigDecimal cholesterolNrv) {
      this.cholesterolNrv = cholesterolNrv;
   }

   public void setCalciumNrv(final BigDecimal calciumNrv) {
      this.calciumNrv = calciumNrv;
   }

   public void setSodiumNrv(final BigDecimal sodiumNrv) {
      this.sodiumNrv = sodiumNrv;
   }

   public void setFoodImage(final String foodImage) {
      this.foodImage = foodImage;
   }

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

   public void setLabelList(final List<String> labelList) {
      this.labelList = labelList;
   }

   public void setMainList(final List<String> mainList) {
      this.mainList = mainList;
   }

   public void setAuxList(final List<String> auxList) {
      this.auxList = auxList;
   }

   public void setDosList(final List<String> dosList) {
      this.dosList = dosList;
   }

   public void setMonthlySales(final Integer monthlySales) {
      this.monthlySales = monthlySales;
   }

   public void setGoodProbability(final BigDecimal goodProbability) {
      this.goodProbability = goodProbability;
   }
}
