package com.bonus.canteen.core.order.deprecated.vo;

import com.bonus.canteen.core.common.enums.AllocMealtimeTypeEnum;
import com.bonus.canteen.core.order.utils.LeNumUtil;
import com.bonus.canteen.core.report.api.vo.ReportOrderDetaiVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalDate;

@ApiModel("订单餐次详情统计VO")
public class OrdIntervalDetailStatVO {
   @ApiModelProperty("订单日期 yyyy-MM-dd")
   private LocalDate ordGoodsDate;
   @ApiModelProperty("餐次id")
   private Long intervalId;
   @ApiModelProperty(
      value = "餐次类型",
      hidden = true
   )
   private Long mealtimeType;
   @ApiModelProperty("餐次名称")
   private String intervalName;
   @ApiModelProperty("商品id")
   private Long goodsId;
   @ApiModelProperty("商品名称")
   private String goodsName;
   @ApiModelProperty("商品数量")
   private Integer quantity;
   @ApiModelProperty("销售方式 1 按份  2 称重")
   private Integer salesMode;

   public static OrdIntervalDetailStatVO of(ReportOrderDetaiVO reportOrderDetaiVO) {
      OrdIntervalDetailStatVO vo = new OrdIntervalDetailStatVO();
      vo.setOrdGoodsDate(reportOrderDetaiVO.getOrdGoodsDate());
      vo.setMealtimeType(reportOrderDetaiVO.getMealtimeType());
      vo.setGoodsId(reportOrderDetaiVO.getGoodsDishesId());
      vo.setGoodsName(reportOrderDetaiVO.getGoodsDishesName());
      vo.setQuantity(reportOrderDetaiVO.getQuantity());
      vo.setSalesMode(reportOrderDetaiVO.getSalesMode());
      if (LeNumUtil.isValidId(vo.getMealtimeType())) {
         vo.setIntervalId(vo.getMealtimeType());
         vo.setIntervalName(AllocMealtimeTypeEnum.getDescByKey(vo.getMealtimeType().intValue()));
      }

      return vo;
   }

   public LocalDate getOrdGoodsDate() {
      return this.ordGoodsDate;
   }

   public Long getIntervalId() {
      return this.intervalId;
   }

   public Long getMealtimeType() {
      return this.mealtimeType;
   }

   public String getIntervalName() {
      return this.intervalName;
   }

   public Long getGoodsId() {
      return this.goodsId;
   }

   public String getGoodsName() {
      return this.goodsName;
   }

   public Integer getQuantity() {
      return this.quantity;
   }

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

   public void setOrdGoodsDate(final LocalDate ordGoodsDate) {
      this.ordGoodsDate = ordGoodsDate;
   }

   public void setIntervalId(final Long intervalId) {
      this.intervalId = intervalId;
   }

   public void setMealtimeType(final Long mealtimeType) {
      this.mealtimeType = mealtimeType;
   }

   public void setIntervalName(final String intervalName) {
      this.intervalName = intervalName;
   }

   public void setGoodsId(final Long goodsId) {
      this.goodsId = goodsId;
   }

   public void setGoodsName(final String goodsName) {
      this.goodsName = goodsName;
   }

   public void setQuantity(final Integer quantity) {
      this.quantity = quantity;
   }

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

}
