package com.chushang.inspection.terminal.query;

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 StoreQuery extends CommonParam {

    /**
     * 商户id
     */
    @Condition(name = "store_id")
    private Long storeId;

    /**
     * 商户id列表
     */
    @Condition(name = "store_id", type = Condition.ConditionType.in)
    private List<Long> storeIds;

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

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

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

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

    /**
     * 商户状态
     */
    @Condition(name = "state")
    @Range(min = 0, max = 10, message = "商户状态格式错误")
    private Integer state;

    /**
     * 是否占用
     */
    @Range(min = 0, max = 1, message = "占用状态格式错误")
    private Integer occupy;

    /**
     * 终端sn号
     */
    @Condition(name = "terminal_sn", type = Condition.ConditionType.eq, tableName = "s")
    @Size(max = 100, message = "终端sn号不能超过100个字符")
    private String terminalSn;

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

    /**
     * 商户联系人
     */
    @Condition(name = "store_contact", type = Condition.ConditionType.like)
    @Size(max = 128, message = "商户联系人不能超过128个字符")
    private String storeContact;

    /**
     * 商户联系方式
     */
    @Condition(name = "store_phone", type = Condition.ConditionType.like)
    @Size(max = 50, message = "商户联系方式不能超过50个字符")
    private String storePhone;

    /**
     * 商户地址
     */
    @Condition(name = "store_address", type = Condition.ConditionType.like)
    @Size(max = 300, message = "商户地址不能超过300个字符")
    private String storeAddress;

    /**
     * 特殊商户编号
     */
    @Condition(name = "special_num", type = Condition.ConditionType.like)
    @Size(max = 30, message = "特殊商户编号不能超过30个字符")
    private String specialNum;

    /**
     * 创建时间
     */
    @Condition(name = "create_time", type = Condition.ConditionType.between, tableName = "s")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private List<LocalDateTime> createTime;

    /**
     * 创建时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    /**
     * 创建时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    /**
     * 门店名称
     */
    @Condition(name = "shop_name", type = Condition.ConditionType.like, tableName = "s")
    @Size(max = 128, message = "门店名称不能超过128个字符")
    private String shopName;

}



