package com.starry.admin.modules.clerk.enums;

import lombok.Getter;

@Getter
public enum ClerkMediaReviewState {

    DRAFT("draft"),
    PENDING("pending"),
    APPROVED("approved"),
    REJECTED("rejected");

    private final String code;

    ClerkMediaReviewState(String code) {
        this.code = code;
    }

    public static ClerkMediaReviewState fromCode(String code) {
        if (code == null || code.isEmpty()) {
            return DRAFT;
        }
        for (ClerkMediaReviewState state : values()) {
            if (state.code.equalsIgnoreCase(code) || state.name().equalsIgnoreCase(code)) {
                return state;
            }
        }
        return DRAFT;
    }
}
