
package dev.sonpx.loyalty.mcp.enums.schedule;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import dev.sonpx.loyalty.mcp.enums.EnumBase;
import java.util.Arrays;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum MonthOfYear implements EnumBase {
    JANUARY("1"),
    FEBRUARY("2"),
    MARCH("3"),
    APRIL("4"),
    MAY("5"),
    JUNE("6"),
    JULY("7"),
    AUGUST("8"),
    SEPTEMBER("9"),
    OCTOBER("10"),
    NOVEMBER("11"),
    DECEMBER("12");

    @JsonValue
    private final String code;

    @JsonCreator
    public static MonthOfYear fromCode(String code) {
        return Arrays.stream(values())
                .filter(month -> month.getCode().equals(code))
                .findFirst()
                .orElse(null);
    }
}
