/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package cn.ysk.cashier.dto.product;

import cn.ysk.cashier.annotation.Query;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;

import static cn.ysk.cashier.annotation.Query.Type.*;

/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-12-11
**/
@Data
public class TbProductQueryV2Criteria {
    @Query
    private Integer id;

    /** 精确 */
    @Query
    private String shopId;

    /** 精确 */
    @Query(type = INNER_LIKE)
    private String name;

    @Query
    private String categoryId;

    /** 精确 */
    @Query
    private Integer status =1;

    /** 精确 */
    @Query
    private Integer isDel = 0;

    @Query
    private Integer isPauseSale;

    @Query
    private Integer isGrounding;

    @Query
    private String type;

    @Query(type = IN)
    private List<String> typeEnum = Arrays.asList("normal","sku");

    @Query(type = BETWEEN)
    private List<Long> createdAt;

    private Integer page;
    private Integer size;
    private String sort;

    public void setType(String type) {
        if(StringUtils.isNotBlank(type)){
            this.typeEnum=Arrays.asList(type);
            this.type = null;
        }
    }
}