package com.chushang.inspection.terminal.query;

import cn.hutool.core.date.DatePattern;
import com.chushang.common.mybatis.annotation.Condition;
import com.chushang.common.mybatis.page.CommonParam;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class TerminalQuery extends CommonParam {



    /**
     * 商户编号
     */
    @Size(max = 64, message = "商户编号不能超过64个字符")
    @Condition(name = "store_no", type = Condition.ConditionType.eq, tableName = "s")
    private String storeNo;
    @Condition(name = "store_name", type = Condition.ConditionType.like, tableName = "s")
    private String storeName;
    /**
     * 终端编号
     */
    @Size(max = 30, message = "终端编号不能超过30个字符")
    @Condition(name = "terminal_no", type = Condition.ConditionType.eq, tableName = "t")
    private String terminalNo;
    /**
     * 终端sn号
     */
    @Size(max = 100, message = "终端sn号不能超过100个字符")
    @Condition(name = "terminal_sn", type = Condition.ConditionType.eq, tableName = "t")
    private String terminalSn;
    /**
     * 终端版本号
     */
    @Size(max = 64, message = "终端版本号不能超过64个字符")
    @Condition(name = "terminal_version", type = Condition.ConditionType.like, tableName = "t")
    private String terminalVersion;
    /**
     * 终端类型
     */
    @Range(min = 1, max = 10, message = "终端类型输入错误")
    @Condition(name = "terminal_type", type = Condition.ConditionType.eq, tableName = "t")
    private Integer terminalType;
    /**
     * 终端地址
     */
    @Size(max = 300, message = "终端版本号不能超过300个字符")
    @Condition(name = "terminal_address", type = Condition.ConditionType.eq, tableName = "t")
    private String terminalAddress;
    /**
     * 所属部门
     */
    @Condition(name = "dept_id", type = Condition.ConditionType.eq, tableName = "s")
    private Long deptId;
    /**
     * 所属银行
     */
    @Condition(name = "task_id", type = Condition.ConditionType.eq, tableName = "s")
    private Long taskId;
    /**
     * 巡检状态 1 以巡检 2未巡检
     */
    @Range(min = 1, max = 2, message = "巡检状态输入错误")
    @Condition(name = "inspection_status", type = Condition.ConditionType.eq, tableName = "ti")
    private Integer inspectionStatus;
    /**
     * 终端来源
     */
    @Range(min = 1, max = 10, message = "终端来源输入错误")
    @Condition(name = "inspection_source", type = Condition.ConditionType.eq, tableName = "ti")
    private Integer terminalSource;
    /**
     * 商户状态
     */
    @Range(min = 1, max = 3, message = "商户状态输入错误")
    @Condition(name = "`state`", type = Condition.ConditionType.eq, tableName = "s")
    private Integer storeState;
    /**
     * 巡检时间
     */
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Condition(name = "`inspection_time`", type = Condition.ConditionType.in, tableName = "ti")
    private List<LocalDateTime> inspectionTime;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Condition(name = "`create_time`", type = Condition.ConditionType.in, tableName = "s")
    private List<LocalDateTime> createTimes;
    /**
     * 终端型号
     */
    @Size(max = 64, message = "终端型号不能超过64个字符")
    @Condition(name = "`terminal_model`", type = Condition.ConditionType.like, tableName = "t")
    private String terminalModel;
    /**
     * 下级任务id
     */
    private List<Long> lowerTaskIds;
    /**
     * 用于 查询用户id
     */
    @Condition(name = "`admin_id`", type = Condition.ConditionType.in, tableName = "s")
    private List<Long> userIds;
    /**
     * 所属项目id
     */
    @Condition(name = "`project_id`", type = Condition.ConditionType.eq, tableName = "p")
    private Long projectId;

    /**
     * 用户id
     */
    @Condition(name = "`user_id`", type = Condition.ConditionType.eq, tableName = "i")
    private Long userId;


    private Long terminalId;
    @Condition(name = "store_id", type = Condition.ConditionType.eq, tableName = "s")
    private Long storeId;
}
