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

import lombok.Getter;

@Getter
public enum MediaKind {

    IMAGE("image"),
    VIDEO("video");

    private final String code;

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

    public static boolean isVideo(String value) {
        return VIDEO.code.equalsIgnoreCase(value);
    }

    public static boolean isImage(String value) {
        return IMAGE.code.equalsIgnoreCase(value);
    }

    public static MediaKind fromCode(String value) {
        for (MediaKind kind : values()) {
            if (kind.code.equalsIgnoreCase(value)) {
                return kind;
            }
        }
        throw new IllegalArgumentException("Unsupported media kind: " + value);
    }
}
