package ru.soune.nocopy.entity.file;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;

@Getter
public enum FileType {
    IMAGE("image", Arrays.asList("jpg", "jpeg", "png", "bmp")),
    VIDEO("video", Arrays.asList("mp4", "avi", "mov", "wmv", "flv", "mkv", "webm", "m4v", "mpg", "mpeg",
            "3gp", "3g2", "f4v", "m2ts", "mts", "vob", "ogv", "divx")),
    AUDIO("audio", List.of("wav")),
    DOCUMENT("document", Arrays.asList("pdf"));


    private final String displayName;
    private final List<String> allowedExtensions;

    FileType(String displayName, List<String> allowedExtensions) {
        this.displayName = displayName;
        this.allowedExtensions = allowedExtensions;
    }

    public String getDisplayName() {
        return displayName;
    }

    public List<String> getAllowedExtensions() {
        return allowedExtensions;
    }

    public boolean supportsExtension(String extension) {
        return allowedExtensions.contains(extension.toLowerCase());
    }
}
