package com.njcn.gather.icd.pojo.param;

import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * @author caozehui
 * @data 2025-02-11
 */
@Data
public class PqIcdPathParam {
    @ApiModelProperty(value = "名称", required = true)
    @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
    @Pattern(regexp = PatternRegex.ICD_NAME_REGEX, message = DetectionValidMessage.ICD_NAME_FORMAT_ERROR)
    private String name;

    @ApiModelProperty(value = "存储路径", required = true)
    @NotBlank(message = DetectionValidMessage.ICD_PATH_NOT_BLANK)
    @Pattern(regexp = PatternRegex.ICD_PATH_REGEX, message = DetectionValidMessage.ICD_PATH_FORMAT_ERROR)
    private String path;

    @ApiModelProperty(value = "是否支持电压相角、电流相角指标，0表示否，1表示是", required = true)
    private Integer angle;

    @ApiModelProperty(value = "角型接线时是否使用相别的指标来进行检测，0表示否，1表示是", required = true)
    private Integer usePhaseIndex;

    @ApiModelProperty(value = "映射文件", required = true)
    private MultipartFile mappingFile;

    /**
     * 分页查询实体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class QueryParam extends BaseParam {
        @ApiModelProperty(value = "名称", required = true)
        private String name;
    }


    /**
     * 更新参数
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class UpdateParam extends PqIcdPathParam {
        @ApiModelProperty(value = "id", required = true)
        @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
        @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
        private String id;
    }
}
