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

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;

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

public class MenuDishesImportDTO implements Serializable {

   public MenuDishesImportDTO() {

   }

   @ExcelProperty(
      index = 0
   )
   private String dishesName;
   @ExcelProperty(
      index = 1
   )
   private BigDecimal price;
   @ExcelProperty(
      index = 2
   )
   private String dishesTypeName;
   @ExcelProperty(
      index = 3
   )
   private String cookName;
   @ExcelProperty(
      index = 4
   )
   private String menuMaterialNames;
   @ExcelProperty(
      index = 5
   )
   private Integer salesMode;
   @ExcelProperty(
      index = 6
   )
   private Integer unitPrice;
   @ExcelProperty(
      index = 7
   )
   private Long sizeType;
   @ExcelProperty(
      index = 8
   )
   private Double weight;
   @ExcelProperty(
      index = 9
   )
   private BigDecimal largePrice;
   @ExcelProperty(
      index = 10
   )
   private Double largeWeight;
   @ExcelProperty(
      index = 11
   )
   private BigDecimal littlePrice;
   @ExcelProperty(
      index = 12
   )
   private Double littleWeight;
   @ExcelProperty(
      index = 13
   )
   private String areaName;
   @ExcelProperty(
      index = 14
   )
   private String canteenName;
   @ExcelProperty(
      index = 15
   )
   private String stallName;
   @ExcelIgnore
   private String failReason;

   public BigDecimal getPrice() {
      return ObjectUtil.isNull(this.price) ? BigDecimal.ZERO : this.price.setScale(2, RoundingMode.HALF_UP);
   }

   public Integer getSalesMode() {
      return ObjectUtil.isNull(this.salesMode) ? 1 : this.salesMode;
   }

   public BigDecimal getLargePrice() {
      return ObjectUtil.isNull(this.largePrice) ? BigDecimal.ZERO : this.largePrice.setScale(2, RoundingMode.HALF_UP);
   }

   public BigDecimal getLittlePrice() {
      return ObjectUtil.isNull(this.littlePrice) ? BigDecimal.ZERO : this.littlePrice.setScale(2, RoundingMode.HALF_UP);
   }

   public Integer getUnitPrice() {
      return (Integer)Optional.ofNullable(this.unitPrice).orElse(100);
   }

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

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

   public String getDishesTypeName() {
      return this.dishesTypeName;
   }

   public String getCookName() {
      return this.cookName;
   }

   public String getMenuMaterialNames() {
      return this.menuMaterialNames;
   }

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

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

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

   public String getAreaName() {
      return this.areaName;
   }

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

   public String getStallName() {
      return this.stallName;
   }

   public String getFailReason() {
      return this.failReason;
   }

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

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

   public void setDishesTypeName(final String dishesTypeName) {
      this.dishesTypeName = dishesTypeName;
   }

   public void setCookName(final String cookName) {
      this.cookName = cookName;
   }

   public void setMenuMaterialNames(final String menuMaterialNames) {
      this.menuMaterialNames = menuMaterialNames;
   }

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

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

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

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

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

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

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

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

   public void setAreaName(final String areaName) {
      this.areaName = areaName;
   }

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

   public void setStallName(final String stallName) {
      this.stallName = stallName;
   }

   public void setFailReason(final String failReason) {
      this.failReason = failReason;
   }
}
