
package com.tmerclub.cloud.search.constant;

import org.elasticsearch.search.sort.SortOrder;


/**
 * 时间排序
 * @author lhd
 * @date 2023/01/30
 */
public enum EsTimeRangeEnum {

    /**
     * 全部
     */
    ALL(0, "createTime", SortOrder.ASC),

    /**
     * 最近一年
     */
    LAST_YEAR(1, "createTime", SortOrder.DESC),

    /**
     * 最近三个月
     */
    LAST_THREE_MONTHS(2, "saleNum", SortOrder.DESC),

    /**
     * 最近一个月
     */
    LAST_MONTH(3, "saleNum", SortOrder.ASC),

    /**
     * 最近一个星期
     */
    LAST_WEEK(4, "priceFee", SortOrder.DESC),
    ;

    private final Integer value;

    private final String param;

    private final SortOrder order;

    public Integer value() {
        return value;
    }

    EsTimeRangeEnum(Integer value, String param, SortOrder order) {
        this.value = value;
        this.param = param;
        this.order = order;
    }

    public String param() {
        return param;
    }

    public SortOrder order() {
        return order;
    }
}
