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

import com.bonus.common.houqin.constant.LeConstants;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import java.time.LocalTime;
/**
 * 餐次时段VO
 * @author 19814
 */
@Data
@ToString
@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(CookMealtimeModelVO mealtimeModel) {
      this.intervalId = (long)mealtimeModel.getMealtimeType();
      this.intervalName = mealtimeModel.getMealtimeName();
      this.startTime = mealtimeModel.getStartTime();
      this.endTime = mealtimeModel.getEndTime();
      this.ifUse = LeConstants.COMMON_YES;
   }

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

}
