package com.tashow.cloud.productapi.api.product.vo.prodreservationconfig;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.tashow.cloud.productapi.api.product.vo.prodadditionalfeedates.ProdAdditionalFeeBlackVO;
import com.tashow.cloud.productapi.general.StringListTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@Schema(description = "管理后台 - 商品紧急响应服务设置 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProdReservationInfoReqVO {

    /**
     * 预约配置的唯一标识符
     */
    @TableId
    private Long id;
    /**
     * 关联的商品ID
     */
    private Long prodId;
    /**
     * 预约时段设置
     */
    @TableField(typeHandler = StringListTypeHandler.class)
    private List<String> reservationTimeSlots;
    /**
     * 需提前多少小时预约
     */
    private Integer advanceHours;
    /**
     * 预约日期范围 7天 10天 15天 30天
     */
    private Integer reservationDateRange;
    /**
     * 是否允许更改预约时间 1可以 0不可以
     */
    private Integer allowChange;

    /**
     * 时间段
     */
    private Integer timeSlot;

    /**
     * 更改预约时间的时间规则（如服务开始前1小时可更改）
     */
    private Integer changeTimeRule;
    /**
     * 允许更改预约时间的最大次数
     */
    private Integer maxChangeTimes;

    /**
     * 预约时间区间设置
     */
    @TableField(exist=false)
    private TimeBookVO timeBook;

    public TimeBookVO getTimeBook() {
        if (this.timeBook == null) {
            this.timeBook = new TimeBookVO();
            this.timeBook.setTimeSlot(this.timeSlot);
            this.timeBook.setReservationTimeSlots(this.reservationTimeSlots);
        }
        return this.timeBook;
    }

    public void setTimeBook(TimeBookVO timeBook) {
        this.timeBook = timeBook;
    }

    @Schema(description = "预约黑名单日期设置")
    public List<ProdAdditionalFeeBlackVO> prodReservationBlackList = new ArrayList<>();

}