package com.cf.imes.module.executor.controller.admin.plan.vo;

import com.cf.imes.framework.es.core.valid.CreateGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.Valid;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;

@Schema(description = "管理后台 - 生产单开料排单新增/修改 Request VO")
@Data
public class PlanSaveReqVO {

    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12776")
    private Long id;

    /*@Schema(description = "排单号", requiredMode = Schema.RequiredMode.REQUIRED)
    private String planNo;*/

    @Schema(description = "排序优先级", requiredMode = Schema.RequiredMode.REQUIRED)
    //@NotNull(groups = CreateGroup.class,message = "排序优先级不能为空")
    private Long sort;

    @Schema(description = "排单类型：1 混单排单，2 生产单排单", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @NotNull(message = "排单类型：1 混单排单，2 生产单排单不能为空", groups = CreateGroup.class)
    private Integer type;

    @Schema(description = "排单状态：0 新单，1 板材已申请，2 开料中，3 已开料", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotNull(message = "排单状态：0 新单，1 板材已申请，2 开料中，3 已开料不能为空", groups = CreateGroup.class)
    private Integer status;

    @Schema(description = "是否支付：0 否，1 是", requiredMode = Schema.RequiredMode.REQUIRED)
    //@NotNull(message = "是否支付：0 否，1 是不能为空")
    private Boolean isPay;

    @Schema(description = "机台 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16707")
    @NotNull(message = "机台 ID不能为空")
    private Long machineId;

    @Schema(description = "计划时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "计划时间不能为空", groups = CreateGroup.class)
    private LocalDateTime planTime;

    /*@Schema(description = "生产单id列表", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<Long> orderIds;*/

    /*@Schema(description = "板件id列表")
    private List<Long> plateIds;*/

    @Schema(description = "生产单id与商品id 列表",requiredMode = Schema.RequiredMode.REQUIRED)
    private List<Item> itemList;

    @Schema(description = "备注")
    private String remark;

    @Schema(description = "生产操作人", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "生产操作人不能为空", groups = CreateGroup.class)
    private String operator;

    @Schema(description = "生产时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "生产时间不能为空", groups = CreateGroup.class)
    private LocalDateTime produceTime;

    @Valid
    @Data
    public static class Item {
        @Schema(description = "生产单id")
        @NotNull
        private Long orderId;
        @Schema(description = "商品id")
        @NotNull
        private Long goodsId;
    }
}