package com.njcn.process.pojo.param;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.njcn.common.pojo.constant.PatternRegex;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.Pattern;
import java.sql.Struct;
import java.time.LocalDate;
import java.util.List;

/**
 * <功能描述>
 *
 * @author wr
 * @createTime: 2023-02-27
 */
@Data
public class TerminalParam {

    @ApiModelProperty("开始时间")
    @Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
    private String startTime;

    @ApiModelProperty("结束时间")
    @Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
    private String endTime;

    @ApiModelProperty("单位id")
    private String id;

    public String getStartTime() {
        if (StrUtil.isNotBlank(this.startTime)) {
            return startTime + " 00:00:00";
        }
        return startTime;
    }

    public String getEndTime() {
        if (StrUtil.isNotBlank(this.endTime)) {
            return endTime + " 23:59:59";
        }
        return endTime;
    }

    @Data
    public static class TerminalPageParam extends TerminalParam {

        @ApiModelProperty(value = "页码")
        private Integer PageNum;

        @ApiModelProperty(value = "条数")
        private Integer PageSize;

        @ApiModelProperty("终端名称")
        private String name;

        @ApiModelProperty(value = "检测结果(0:未开展 1:已开展)")
        private Integer testResults;

        @ApiModelProperty(value = "生产厂家(字典)")
        private List<String> manufacture;

        @ApiModelProperty(value = "是否周期检测列表")
        private Integer type;
    }

    @Data
    public static class TerminalInsertParam {
        @ApiModelProperty(value = "终端编号")
        private String id;

        @ApiModelProperty(value = "终端名称")
        private String name;

        @ApiModelProperty(value = "组织机构名称")
        private String orgName;

        @ApiModelProperty(value = "组织机构ID(外键)")
        private String orgNo;

        @ApiModelProperty(value = "生产厂家")
        private String manufacture;

        @ApiModelProperty(value = "安装位置")
        private String installPlace;

        @ApiModelProperty(value = "检测时间")
        private LocalDate inspectionTime;

        @ApiModelProperty(value = "送检单位")
        private String inspectionUnit;

        @ApiModelProperty(value = "原始数据报告")
        private String originalReport;
//        @ApiModelProperty(value = "检测结果")
//        private String testResults;
//
//
//        @ApiModelProperty(value = "下次检测时间")
//        private LocalDate nextInspectionTime;
//
//        @ApiModelProperty(value = "检测报告")
//        private String inspectionReport;

    }

    @Data
    public static class TerminalUpdateParam {
        @ApiModelProperty(value = "终端编号")
        private String id;

        @ApiModelProperty(value = "终端名称")
        private String name;

        @ApiModelProperty(value = "组织机构名称")
        private String orgName;

        @ApiModelProperty(value = "组织机构ID(外键)")
        private String orgNo;

        @ApiModelProperty(value = "生产厂家")
        private String manufacture;

        @ApiModelProperty(value = "安装位置")
        private String installPlace;

        @ApiModelProperty(value = "检测时间")
        private LocalDate inspectionTime;

        @ApiModelProperty(value = "送检单位")
        private String inspectionUnit;

        @ApiModelProperty(value = "原始数据报告")
        private String originalReport;
    }

    @Data
    public static class DownloadParam {

        @ApiModelProperty(value = "终端id")
        private String id;

        @ApiModelProperty(value = "(0：原始数据报告 1：检测报告)")
        private Integer type;
    }

}
