package com.engine.salary.sys.enums;

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

/**
 * 快照时间点类型
 * <p>Copyright: Copyright (c) 2024</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public enum ShotTimeTypeEnum implements BaseEnum<String> {

    salaryFirstDate("salaryFirstDate", "薪资所属月第一天", 1),
    salaryLastDate("salaryLastDate", "薪资所属月最后一天", 1),
    salaryCycleFromDate("salaryCycleFromDate", "薪资周期起始日期", 1),
    salaryCycleEndDate("salaryCycleEndDate", "薪资周期结束日期", 1);

    private String value;

    private String defaultLabel;

    private int labelId;


    ShotTimeTypeEnum(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 ShotTimeTypeEnum parseByValue(String value) {
        for (ShotTimeTypeEnum e : ShotTimeTypeEnum.values()) {
            if (StringUtils.equals(e.getValue(), value)) {
                return e;
            }
        }
        return salaryCycleFromDate;
    }
}
