package com.njcn.gather.aireport.testreport.pojo.param;

import com.fasterxml.jackson.databind.JsonNode;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

public class TestReportParam {

    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class QueryParam extends BaseParam {
        @ApiModelProperty("关键字，匹配报告编号、合同编号、委托单位或报告模板")
        private String keyword;

        @ApiModelProperty("创建开始时间，yyyy-MM-dd HH:mm:ss")
        private String searchBeginTime;

        @ApiModelProperty("创建结束时间，yyyy-MM-dd HH:mm:ss")
        private String searchEndTime;

        @ApiModelProperty("报告状态")
        private String state;
    }

    @Data
    public static class AddParam {
        @ApiModelProperty("普测报告ID，不传时由后端生成")
        private String id;

        @ApiModelProperty("普测报告编号")
        @NotBlank(message = "普测报告编号不能为空")
        @Size(max = 32, message = "普测报告编号不能超过32个字符")
        private String no;

        @ApiModelProperty("委托单位ID")
        @NotBlank(message = "委托单位不能为空")
        private String clientUnitId;

        @ApiModelProperty("报告模板ID")
        @NotBlank(message = "报告模板不能为空")
        private String reportModelId;

        @ApiModelProperty("检测公司ID")
        @NotBlank(message = "检测公司不能为空")
        private String createUnit;

        @ApiModelProperty("合同编号")
        @NotBlank(message = "合同编号不能为空")
        @Size(max = 32, message = "合同编号不能超过32个字符")
        private String contractNumber;

        @ApiModelProperty("检测依据，JSON数组")
        @NotEmpty(message = "检测依据不能为空")
        private List<String> standard;

        @ApiModelProperty("受资数据，JSON对象或JSON数组")
        @NotNull(message = "受资数据不能为空")
        private JsonNode data;

        @ApiModelProperty("台账校验通过后返回的导入批次ID")
        private String batchId;

        @ApiModelProperty("联系电话")
        @Size(max = 32, message = "联系电话不能超过32个字符")
        private String phonenumber;
    }

    @Data
    public static class UpdateParam extends AddParam {
        @ApiModelProperty("普测报告ID")
        @NotBlank(message = "普测报告ID不能为空")
        private String id;
    }

    @Data
    public static class SubmitAuditParam {
        @ApiModelProperty("普测报告ID")
        @NotBlank(message = "普测报告ID不能为空")
        private String id;

        @ApiModelProperty("审核意见")
        @Size(max = 128, message = "审核意见不能超过128个字符")
        private String checkResult;
    }

    @Data
    public static class LedgerImportParam {
        @ApiModelProperty("校验成功的导入批次ID")
        @NotBlank(message = "导入批次ID不能为空")
        private String batchId;
    }
}
