package com.chushang.inspection.work.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 javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.List;

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

    /**
     * 工单编号
     */
    @Condition(name = "work_no", tableName = "i")
    private String workNo;

    /**
     * 业务员名称
     */
    @Condition(name = "user_name", tableName = "i")
    @Size(max = 32, message = "业务员名称不能超过32个字符")
    private String userName;

    /**
     * 商户编号
     */
    @Condition(name = "store_no", tableName = "isr")
    @Size(max = 64, message = "商户编号不能超过64个字符")
    private String storeNo;

    /**
     * 任务id
     */
    @Condition(name = "task_id", tableName = "i")
    private Long taskId;

    /**
     * 终端编号
     */
    @Condition(name = "terminal_no", tableName = "itr")
    @Size(max = 30, message = "终端sn号不能超过30个字符")
    private String terminalNo;

    /**
     * 商户名称
     */
    @Condition(name = "store_name",type = Condition.ConditionType.like, tableName = "isr")
    @Size(max = 128, message = "商户名称不能超过128个字符")
    private String storeName;

    /**
     * 处理时间
     */
    @Condition(name = "dispose_time", type = Condition.ConditionType.between, tableName = "i")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN)
    private List<LocalDateTime> disposeTime;

    /**
     * 工单状态
     */
    @Condition(name = "wrk_status", type = Condition.ConditionType.in, tableName = "i")
    @Null(message = "内部参数，不允许访问")
    private List<Integer> states;

    /**
     * 下级任务id
     */
    @Condition(name = "lower_task_id", type = Condition.ConditionType.in, tableName = "i")
    private List<Long> lowerTaskIds;

    /**
     * 根据id 下载
     */
    private List<Long> ids;
}
