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

import com.cf.imes.framework.common.validation.InEnum;
import com.cf.imes.framework.common.validation.NumberValid;
import com.cf.imes.module.executor.enums.veneer.VeneerProductLevelEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.math.BigDecimal;

/**
 *
 *
 * @author Gqr
 * @since 2026/1/4 14:26
 */
@Schema(description = "生产管理 - 贴皮管理 新增/修改 Request VO")
@Data
public class VeneerSaveReqVO {
    @Schema(description = "贴皮id")
    private Long id;

    @Schema(description = "贴皮编号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "{veneer.save.veneerNo.not.null}")
    @Length(max = 32, message = "{veneer.save.veneerNo.length.max}")
    @Pattern(
            regexp = "^[^\\\\/:*?\"，]*$",
            message = "{veneer.save.veneerNo.special.character}"
    )
    private String veneerNo;

    @Schema(description = "批次号")
    @Length(max = 32, message = "{veneer.save.batchNo.length.max}")
    private String batchNo;

    @Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "{veneer.save.classificationName.not.null}")
    private String classificationName;

    @Schema(description = "产品等级，0：A类、1：B类、2：C类", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "{veneer.save.productLevel.not.null}")
    @InEnum(value = VeneerProductLevelEnum.class, fieldName = "productLevel")
    private Integer productLevel;

    @Schema(description = "贴皮名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "{veneer.save.veneerName.not.null}")
    @Length(max = 64, message = "{veneer.save.veneerName.length.max}")
    private String veneerName;

    @Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "{veneer.save.num.not.null}")
    @NumberValid(name = "veneer.field.num", integer = 4, fraction = 0)
    @Min(value = 1, message = "{veneer.save.num.positive}")
    @Max(value = 9999, message = "{veneer.save.num.max}")
    private Integer num;

    @Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "{veneer.save.width.not.null}")
    @NumberValid(name = "veneer.field.width", integer = 4, fraction = 2)
    @DecimalMin(value = "0", inclusive = false, message = "{veneer.save.width.positive}")
    @DecimalMax(value = "9999.99", message = "{veneer.save.width.max}")
    private BigDecimal width;

    @Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "{veneer.save.length.not.null}")
    @NumberValid(name = "veneer.field.width", integer = 4, fraction = 2)
    @DecimalMin(value = "0", inclusive = false, message = "{veneer.save.length.positive}")
    @DecimalMax(value = "9999.99", message = "{veneer.save.length.max}")
    private BigDecimal length;

    @Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "{veneer.save.thickness.not.null}")
    @NumberValid(name = "veneer.field.width", integer = 4, fraction = 2)
    @DecimalMin(value = "0", inclusive = false, message = "{veneer.save.thickness.positive}")
    @DecimalMax(value = "9999.99", message = "{veneer.save.thickness.max}")
    private BigDecimal thickness;

    @Schema(description = "颜色")
    @Length(max = 32, message = "{veneer.save.color.length.max}")
    private String color;

    @Schema(description = "材料")
    @Length(max = 32, message = "{veneer.save.material.length.max}")
    private String material;

    @Schema(description = "规格")
    @Length(max = 64, message = "{veneer.save.spec.length.max}")
    private String spec;

    @Schema(description = "品牌")
    @Length(max = 32, message = "{veneer.save.brand.length.max}")
    private String brand;

    @Schema(description = "厂家")
    @Length(max = 64, message = "{veneer.save.factory.length.max}")
    private String factory;

    @Schema(description = "备注", example = "备注")
    @Length(max = 255, message = "{veneer.save.remark.length.max}")
    private String remark;

    @Schema(description = "贴皮照片文件id", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "{veneer.save.fileId.not.null}")
    private Long fileId;
}
