
package dev.sonpx.loyalty.mcp.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum RecordStatus implements EnumBase {

    /** Record is active and eligible for processing. DB code: {@code "A"}. */
    ACTIVE("A"),

    /** Record is logically inactive but retained. DB code: {@code "I"}. */
    INACTIVE("I"),

    /** Record is marked for deletion. DB code: {@code "D"}. */
    DELETE("D");

    @JsonValue
    private final String code;

    @JsonCreator
    public static RecordStatus fromCode(String code) {
        if (code == null) return null;
        for (RecordStatus s : values()) {
            if (s.code.equalsIgnoreCase(code)) return s;
        }
        return null;
    }
}
