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

import com.bonus.canteen.core.menu.enums.AllocMealtimeTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.time.LocalTime;
import java.util.List;

@ApiModel("下发菜谱详情")
public class IssueRecipeIntervalCompressVO implements Serializable {
   @ApiModelProperty("餐次id")
   private Long intervalId;
   @ApiModelProperty("餐次名称")
   private String intervalName;
   @ApiModelProperty("餐次开始时间")
   @JsonFormat(
      pattern = "HH:mm:ss"
   )
   @JsonSerialize(
      using = LocalTimeSerializer.class
   )
   @JsonDeserialize(
      using = LocalTimeDeserializer.class
   )
   private LocalTime startTime;
   @ApiModelProperty("餐次结束时间")
   @JsonFormat(
      pattern = "HH:mm:ss"
   )
   @JsonSerialize(
      using = LocalTimeSerializer.class
   )
   @JsonDeserialize(
      using = LocalTimeDeserializer.class
   )
   private LocalTime endTime;
   @ApiModelProperty("餐品列表")
   private List<IssueRecipeDetailCompressVO> productList;

   public String getIntervalName() {
      return AllocMealtimeTypeEnum.getDescByKey(this.intervalId.intValue());
   }

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

   public LocalTime getStartTime() {
      return this.startTime;
   }

   public LocalTime getEndTime() {
      return this.endTime;
   }

   public List<IssueRecipeDetailCompressVO> getProductList() {
      return this.productList;
   }

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

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

   @JsonFormat(
      pattern = "HH:mm:ss"
   )
   @JsonDeserialize(
      using = LocalTimeDeserializer.class
   )
   public void setStartTime(final LocalTime startTime) {
      this.startTime = startTime;
   }

   @JsonFormat(
      pattern = "HH:mm:ss"
   )
   @JsonDeserialize(
      using = LocalTimeDeserializer.class
   )
   public void setEndTime(final LocalTime endTime) {
      this.endTime = endTime;
   }

   public void setProductList(final List<IssueRecipeDetailCompressVO> productList) {
      this.productList = productList;
   }
}
