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

import lombok.Getter;

@Getter
public enum ClerkMediaUsage {

    PROFILE("profile"),
    AVATAR("avatar"),
    MOMENTS("moments"),
    VOICE_INTRO("voice_intro"),
    PROMO("promo"),
    OTHER("other");

    private final String code;

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

    public static ClerkMediaUsage fromCode(String code) {
        if (code == null || code.isEmpty()) {
            return PROFILE;
        }
        for (ClerkMediaUsage usage : values()) {
            if (usage.code.equalsIgnoreCase(code) || usage.name().equalsIgnoreCase(code)) {
                return usage;
            }
        }
        return PROFILE;
    }
}
