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

import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cf.imes.framework.excel.core.annotations.EnumFormat;
import com.cf.imes.framework.excel.core.convert.EnumConvert;
import com.cf.imes.module.executor.enums.veneer.VeneerProductLevelEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 贴皮 Excel导入 VO
 *
 * @author Gqr
 * @since 2026/1/5 15:28
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false) // 设置 chain = false，避免用户导入有问题
public class VeneerImportExcelVO {

    private Long id;

    private Long organId;

    @ExcelProperty(index = 0)
    private String veneerNo;

    @ExcelProperty(index = 1)
    private String batchNo;

    @ExcelProperty(index = 2)
    private String classificationName;

    @ExcelProperty(index = 3)
    private String veneerName;

    @ExcelProperty(index = 4, converter = EnumConvert.class)
    @EnumFormat(value = VeneerProductLevelEnum.class)
    private Integer productLevel;

    @ExcelProperty(index = 5)
    private String color;

    @ExcelProperty(index = 6)
    private String material;

    @ExcelProperty(index = 7)
    private String length;

    @ExcelProperty(index = 8)
    private String width;

    @ExcelProperty(index = 9)
    private String thickness;

    @ExcelProperty(index = 10)
    private String brand;

    @ExcelProperty(index = 11)
    private String spec;

    @ExcelProperty(index = 12)
    private String factory;

    @ExcelProperty(index = 13)
    private String num;

    @ExcelProperty(index = 14)
    private String remark;

    /**
     * 校验必填
     *
     * @return true：校验成功、false：校验失败（有必填项未填写）
     */
    public boolean validRequired() {
        return CharSequenceUtil.isAllNotEmpty(veneerNo, classificationName, veneerName, length, width, thickness, num)
                && ObjectUtil.isNotNull(productLevel);
    }
}
