package com.lazy.emulate.emulation

enum class ConsoleType(
    val displayName: String,
    val manufacturer: String,
    val fileExtensions: List<String>,
    val isImplemented: Boolean = false,
    val fallbackAspectRatio: Float = 4f / 3f,
    val libretroThumbnailRepo: String = ""
) {
    PS1(
        displayName = "PlayStation",
        manufacturer = "Sony",
        fileExtensions = listOf("bin", "cue", "iso", "img", "pbp", "chd"),
        isImplemented = true,
        fallbackAspectRatio = 4f / 3f,
        libretroThumbnailRepo = "Sony_-_PlayStation"
    ),
    NES(
        displayName = "Nintendo Entertainment System",
        manufacturer = "Nintendo",
        fileExtensions = listOf("nes", "unf", "unif"),
        isImplemented = true,
        fallbackAspectRatio = 256f / 240f,
        libretroThumbnailRepo = "Nintendo_-_Nintendo_Entertainment_System"
    ),
    SNES(
        displayName = "Super Nintendo",
        manufacturer = "Nintendo",
        fileExtensions = listOf("sfc", "smc", "fig", "swc"),
        isImplemented = true,
        fallbackAspectRatio = 4f / 3f,
        libretroThumbnailRepo = "Nintendo_-_Super_Nintendo_Entertainment_System"
    ),
    N64(
        displayName = "Nintendo 64",
        manufacturer = "Nintendo",
        fileExtensions = listOf("n64", "z64", "v64", "ndd"),
        fallbackAspectRatio = 4f / 3f,
        libretroThumbnailRepo = "Nintendo_-_Nintendo_64"
    ),
    GENESIS(
        displayName = "Sega Genesis",
        manufacturer = "Sega",
        fileExtensions = listOf("gen", "md", "smd", "bin"),
        isImplemented = true,
        fallbackAspectRatio = 4f / 3f,
        libretroThumbnailRepo = "Sega_-_Mega_Drive_-_Genesis"
    ),
    PS2(
        displayName = "PlayStation 2",
        manufacturer = "Sony",
        fileExtensions = listOf("iso", "bin", "chd", "cso"),
        fallbackAspectRatio = 4f / 3f,
        libretroThumbnailRepo = "Sony_-_PlayStation_2"
    );

    companion object {
        fun fromExtension(ext: String): List<ConsoleType> {
            return entries.filter { ext.lowercase() in it.fileExtensions }
        }
    }
}
