package com.engine.salary.sys.enums;

import com.engine.salary.enums.BaseEnum;
import org.apache.commons.lang3.StringUtils;

/**
 * 排序枚举
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public enum AscOrDescEnum implements BaseEnum<String> {

    ASC("asc", "正序", 1),
    DESC("desc", "倒序", 1);

    private String value;

    private String defaultLabel;

    private int labelId;


    AscOrDescEnum(String value, String defaultLabel, int labelId) {
        this.value = value;
        this.defaultLabel = defaultLabel;
        this.labelId = labelId;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String getDefaultLabel() {
        return defaultLabel;
    }

    @Override
    public Integer getLabelId() {
        return labelId;
    }

    public static AscOrDescEnum parseByValue(String value) {
        for (AscOrDescEnum taxDeclarationFunctionEnum : AscOrDescEnum.values()) {
            if (StringUtils.equals(taxDeclarationFunctionEnum.getValue(), value)) {
                return taxDeclarationFunctionEnum;
            }
        }
        return ASC;
    }
}
