package com.ningdatech.carapi.industry.enums;

import org.apache.commons.lang3.StringUtils;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @return
 * @author CMM
 * @since 2023/01/04 11:03
 */

@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "QuarterEnum", description = "季度-枚举")
public enum QuarterEnum {
    FIRST_QUARTER(1,"第一季度"),
    SECOND_QUARTER(2,"第二季度"),
    THIRD_QUARTER(3,"第三季度"),
    FOURTH_QUARTER(4,"第四季度");

    private  Integer code;
    private  String desc;

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDescByCode(Integer code) {
        if(Objects.isNull(code)){
            return StringUtils.EMPTY;
        }
        for (QuarterEnum t : QuarterEnum.values()) {
            if (code.equals(t.getCode())) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }

    public boolean eq(String val) {
        return this.name().equals(val);
    }
}
