package org.dromara.app.domain.bo;

import org.dromara.app.domain.AppSchedule;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.List;

/**
 * 日程排列业务对象 app_schedule
 *
 * @author Lion Li
 * @date 2026-04-25
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = AppSchedule.class, reverseConvertGenerate = false)
public class AppScheduleBo extends BaseEntity {

    /**
     * 
     */
    @NotNull(message = "不能为空", groups = { EditGroup.class })
    private Long id;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 排程名称
     */
    private String name;

    private List<String> deviceNos;


    /**
     * 状态 0-关闭 1 开启
     */
    private String status;

    @NotEmpty(message = "至少需要配置一天")
    private List<AppScheduleDetail> details;

    // 内部类
    @Data
    public static class AppScheduleDetail  {

        private Long id;
        @NotNull(message = "星期不能为空")
        @Min(1) @Max(7)
        private Integer weekday;

        @NotNull(message = "开始时间不能为空")
        private List<TimeSlot>  timeData;

        //@NotNull(message = "浇水区域不能为空")
        private Integer zones;  // 位掩码

        private String triggerType = "0";

        private String status = "0";

    }


    @Data
    public static class TimeSlot {
        private String startTime;
        private Integer durationMin;
    }


}
