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

import com.bonus.canteen.core.menu.model.AllocMealtimeModel;
import com.bonus.common.houqin.constant.LeConstants;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalTime;

@ApiModel("餐次时段VO")
public class DeviceMealtimeVO {
   @ApiModelProperty("餐次id")
   private Long intervalId;
   @ApiModelProperty("餐次名称")
   private String intervalName;
   @JsonFormat(
      pattern = "HH:mm:ss"
   )
   @ApiModelProperty("开始时间")
   private LocalTime startTime;
   @JsonFormat(
      pattern = "HH:mm:ss"
   )
   @ApiModelProperty("结束时间")
   private LocalTime endTime;
   @ApiModelProperty("是否启用")
   private Integer ifUse;

   public void dataConvertHandler(AllocMealtimeModel mealtimeModel) {
      this.intervalId = (long)mealtimeModel.getMealtimeType();
      this.intervalName = mealtimeModel.getMealtimeName();
      this.startTime = mealtimeModel.getStartTime();
      this.endTime = mealtimeModel.getEndTime();
      this.ifUse = LeConstants.COMMON_YES;
   }

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

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

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

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

   public Integer getIfUse() {
      return this.ifUse;
   }

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

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

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

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

   public void setIfUse(final Integer ifUse) {
      this.ifUse = ifUse;
   }

}
