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.SysUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
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 AndroidRecipeTypeDetailVO implements Serializable {
   @ApiModelProperty("父类id")
   private Long parentId;
   @ApiModelProperty("菜品id")
   private Long dishesId;
   @ApiModelProperty("商品id")
   private Long productId;
   @ApiModelProperty("套餐id")
   private Long packageId;
   @ApiModelProperty("自定义id")
   private Integer customId;
   @ApiModelProperty("餐品类型")
   private Integer mealType;
   @ApiModelProperty("名称")
   private String productName;
   @ApiModelProperty("图片")
   private String imageUrl;
   @ApiModelProperty("标签")
   private List<String> labelList;
   @ApiModelProperty("口味列表")
   private List<AppletTasteVO> tasteList;
   @ApiModelProperty("剩余数量")
   private Integer surplusNum;
   @ApiModelProperty("个人限购数量")
   private Integer restrictNum;
   @ApiModelProperty("优惠价")
   private Integer prefPrice;
   @ApiModelProperty("销售价格")
   private Integer salePrice;
   @ApiModelProperty("原价")
   private Integer originalPrice;
   @ApiModelProperty("销售方式(1按份,2称重)")
   private Integer salesMode;
   @ApiModelProperty("称重单位多少克(默认50g)")
   private Integer unitPrice;
   @ApiModelProperty("厨师名称")
   private String chefName;
   @ApiModelProperty("热量(千卡/100g)")
   private BigDecimal calories;
   @ApiModelProperty("蛋白质(g/100g)")
   private BigDecimal protein;
   @ApiModelProperty("脂肪(g/100g)")
   private BigDecimal fat;
   @ApiModelProperty("碳水化合物(g/100g)")
   private BigDecimal carbohydrate;
   @ApiModelProperty("膳食纤维(g/100g)")
   private BigDecimal dietaryFiber;
   @ApiModelProperty("胆固醇(mg/100g)")
   private BigDecimal cholesterol;
   @ApiModelProperty("钙(mg/100g)")
   private BigDecimal calcium;
   @ApiModelProperty("钠(mg/100g)")
   private BigDecimal sodium;
   @ApiModelProperty("食堂id")
   private Long canteenId;
   @ApiModelProperty("档口或店铺id")
   private Long shopstallId;
   @JsonIgnore
   @ApiModelProperty("商品规格(g)")
   private BigDecimal weight;
   @ApiModelProperty("标签")
   private String typeName;
   @ApiModelProperty("标签ID")
   private Long typeId;
   @ApiModelProperty("热量NRV(千卡/100g)")
   private BigDecimal caloriesNrv;
   @ApiModelProperty("蛋白质NRV(g/100g)")
   private BigDecimal proteinNrv;
   @ApiModelProperty("脂肪NRV(g/100g)")
   private BigDecimal fatNrv;
   @ApiModelProperty("碳水化合物NRV(g/100g)")
   private BigDecimal carbohydrateNrv;
   @ApiModelProperty("膳食纤维NRV(g/100g)")
   private BigDecimal dietaryFiberNrv;
   @ApiModelProperty("胆固醇NRV(mg/100g)")
   private BigDecimal cholesterolNrv;
   @ApiModelProperty("钙NRV(mg/100g)")
   private BigDecimal calciumNrv;
   @ApiModelProperty("钠NRV(mg/100g)")
   private BigDecimal sodiumNrv;

   public String getImageUrl() {
      return SysUtil.getCutFileUrl(this.imageUrl);
   }

   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 Long getParentId() {
      return this.parentId;
   }

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

   public Long getProductId() {
      return this.productId;
   }

   public Long getPackageId() {
      return this.packageId;
   }

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

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

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

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

   public List<AppletTasteVO> getTasteList() {
      return this.tasteList;
   }

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

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

   public Integer getPrefPrice() {
      return this.prefPrice;
   }

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

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

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

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

   public String getChefName() {
      return this.chefName;
   }

   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 Long getCanteenId() {
      return this.canteenId;
   }

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

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

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

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

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

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

   public void setProductId(final Long productId) {
      this.productId = productId;
   }

   public void setPackageId(final Long packageId) {
      this.packageId = packageId;
   }

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

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

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

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

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

   public void setTasteList(final List<AppletTasteVO> tasteList) {
      this.tasteList = tasteList;
   }

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

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

   public void setPrefPrice(final Integer prefPrice) {
      this.prefPrice = prefPrice;
   }

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

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

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

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

   public void setChefName(final String chefName) {
      this.chefName = chefName;
   }

   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 setCanteenId(final Long canteenId) {
      this.canteenId = canteenId;
   }

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

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

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

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

   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;
   }

}
