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

import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.module.executor.validation.plan.PlanTypeValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import jakarta.validation.constraints.Pattern;
import java.time.LocalDateTime;
import java.util.List;

import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "管理后台 - 订单开料排单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PlanPageReqVO extends PageParam {

    @Schema(description = "排单号")
    @Pattern(regexp = "^[0-9]*$",message = "排单号必须为数字")
    @Length(max = 19,message = "排单号长度不能超过19位")
    private String id;


    @Schema(description = "是否翻页-true：上，false：下")
    private Boolean isUp;


    @Schema(description = "排序优先级")
    private Integer sort;

    @Schema(description = "排单类型：1 混单排单，2 订单排单")
    @PlanTypeValid
    private Integer type;

    @Schema(description = "排单状态：0 未开料，1 开料中，2 已开料")
//    @PlanStatusValid
    private List<Integer> status;


    @Schema(description = "是否已投产")
    private Boolean isScheduled;

    @Schema(description = "机台 ID", example = "16707")
    private Long machineId;

    @Schema(description = "计划时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime[] planTime;

    @Schema(description = "订单号")
    @Pattern(regexp = "^[0-9]*$",message = "订单号必须为数字")
    @Length(max = 19,message = "订单号长度不能超过19位")
    private String orderNos;


    @Schema(description = "订单客户")
    @Length(max = 255, message = "客户数据过长，请重新输入")
    private String customer;


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


    @Schema(description = "创建时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime[] createTime;


    @Schema(description = "生产操作人")
    private String operator;


    @Schema(description = "生产时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime[] produceTime;

}