package eu.kanade.tachiyomi.animeextension.en.oppaistream

import eu.kanade.tachiyomi.animesource.model.AnimeFilter
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList

open class SelectFilter(
    displayName: String,
    private val vals: Array<Pair<String, String>>,
) : AnimeFilter.Select<String>(
    displayName,
    vals.map { it.first }.toTypedArray(),
) {
    fun selectedValue() = vals[state].second
}

class OrderByFilter : SelectFilter(
    "Sort By",
    arrayOf(
        Pair("A-Z", "az"),
        Pair("Z-A", "za"),
        Pair("Recently Released", "recent"),
        Pair("Oldest Releases", "old"),
        Pair("Most Views", "views"),
        Pair("Highest Rated", "rating"),
        Pair("Recently Uploaded", "uploaded"),
        Pair("Randomize", "random"),
    ),
)

class TriFilter(name: String, val value: String) : AnimeFilter.TriState(name)

private fun getGenreList(): List<TriFilter> = listOf(
    TriFilter("4k", "4k"),
    TriFilter("Ahegao", "ahegao"),
    TriFilter("Anal", "anal"),
    TriFilter("Armpit Masturbation", "armpitmasturbation"),
    TriFilter("BDSM", "bdsm"),
    TriFilter("Beach", "beach"),
    TriFilter("Big Boobs", "bigboobs"),
    TriFilter("Black Hair", "blackhair"),
    TriFilter("Blonde Hair", "blondehair"),
    TriFilter("BlowJob", "blowjob"),
    TriFilter("Blue Hair", "bluehair"),
    TriFilter("Bondage", "bondage"),
    TriFilter("BoobJob", "boobjob"),
    TriFilter("Brown Hair", "brownhair"),
    TriFilter("Censored", "censored"),
    TriFilter("Comedy", "comedy"),
    TriFilter("Cosplay", "cosplay"),
    TriFilter("Cowgirl", "cowgirl"),
    TriFilter("Creampie", "creampie"),
    TriFilter("Dark Skin", "darkskin"),
    TriFilter("Demon", "demon"),
    TriFilter("Doggy", "doggy"),
    TriFilter("Dominant Girl", "dominantgirl"),
    TriFilter("Double Penetration", "doublepenetration"),
    TriFilter("Elf", "elf"),
    TriFilter("Facial", "facial"),
    TriFilter("Fantasy", "fantasy"),
    TriFilter("Filmed", "filmed"),
    TriFilter("FootJob", "footjob"),
    TriFilter("Futanari", "futanari"),
    TriFilter("Gangbang", "gangbang"),
    TriFilter("Girls Only", "girlsonly"),
    TriFilter("Glasses", "glasses"),
    TriFilter("Green Hair", "greenhair"),
    TriFilter("Gyaru", "gyaru"),
    TriFilter("HD", "hd"),
    TriFilter("HandJob", "handjob"),
    TriFilter("Harem", "harem"),
    TriFilter("Horror", "horror"),
    TriFilter("Incest", "incest"),
    TriFilter("Inflation", "inflation"),
    TriFilter("Inverted Nipples", "invertednipples"),
    TriFilter("Lactation", "lactation"),
    TriFilter("Loli", "loli"),
    TriFilter("Maid", "maid"),
    TriFilter("Masturbation", "masturbation"),
    TriFilter("Milf", "milf"),
    TriFilter("Mind Break", "mindbreak"),
    TriFilter("Mind Control", "mindcontrol"),
    TriFilter("Missionary", "missionary"),
    TriFilter("Monster", "monster"),
    TriFilter("NTR", "ntr"),
    TriFilter("Nekomimi", "nekomimi"),
    TriFilter("Nurse", "nurse"),
    TriFilter("Old", "old"),
    TriFilter("Orgy", "orgy"),
    TriFilter("POV", "pov"),
    TriFilter("Pink Hair", "pinkhair"),
    TriFilter("Plot", "plot"),
    TriFilter("Pregnant", "pregnant"),
    TriFilter("Public Sex", "publicsex"),
    TriFilter("Purple Hair", "purplehair"),
    TriFilter("Rape", "rape"),
    TriFilter("Red Hair", "redhair"),
    TriFilter("Reverse Gangbang", "reversegangbang"),
    TriFilter("Reverse Rape", "reverserape"),
    TriFilter("Rimjob", "rimjob"),
    TriFilter("Scat", "scat"),
    TriFilter("School Girl", "schoolgirl"),
    TriFilter("Short Hair", "shorthair"),
    TriFilter("Shota", "shota"),
    TriFilter("Small Boobs", "smallboobs"),
    TriFilter("Softcore", "softcore"),
    TriFilter("Succubus", "succubus"),
    TriFilter("Swimsuit", "swimsuit"),
    TriFilter("Teacher", "teacher"),
    TriFilter("Tentacle", "tentacle"),
    TriFilter("Threesome", "threesome"),
    TriFilter("Toys", "toys"),
    TriFilter("Trap", "trap"),
    TriFilter("Tripple Penetration", "tripplepenetration"),
    TriFilter("Tsundere", "tsundere"),
    TriFilter("Ugly Bastard", "uglybastard"),
    TriFilter("Uncensored", "uncensored"),
    TriFilter("Vampire", "vampire"),
    TriFilter("Vanilla", "vanilla"),
    TriFilter("Virgin", "virgin"),
    TriFilter("Watersports", "watersports"),
    TriFilter("White Hair", "whitehair"),
    TriFilter("X-Ray", "x-ray"),
    TriFilter("Yaoi", "yaoi"),
    TriFilter("Yuri", "yuri"),
)

class GenreListFilter(genres: List<TriFilter>) : AnimeFilter.Group<TriFilter>("Genre", genres)

class CheckFilter(name: String, val value: String) : AnimeFilter.CheckBox(name)

private fun getStudioList(): List<CheckFilter> = listOf(
    CheckFilter("44℃ Baidoku", "44℃ Baidoku"),
    CheckFilter("AT-X", "AT-X"),
    CheckFilter("AXsiZ", "AXsiZ"),
    CheckFilter("Alice Soft", "Alice Soft"),
    CheckFilter("Antechinus", "Antechinus"),
    CheckFilter("An♥Tekinus", "An♥Tekinus"),
    CheckFilter("BOOTLEG", "BOOTLEG"),
    CheckFilter("BREAKBOTTLE", "BREAKBOTTLE"),
    CheckFilter("Bomb! Cute! Bomb!", "Bomb! Cute! Bomb!"),
    CheckFilter("Breakbottle", "Breakbottle"),
    CheckFilter("Bunny Walker", "Bunny Walker"),
    CheckFilter("ChuChu", "ChuChu"),
    CheckFilter("Collaboration Works", "Collaboration Works"),
    CheckFilter("Cotton Doll", "Cotton Doll"),
    CheckFilter("Digital Works", "Digital Works"),
    CheckFilter("Global Solutions", "Global Solutions"),
    CheckFilter("HiLLS", "HiLLS"),
    CheckFilter("Himajin Planning", "Himajin Planning"),
    CheckFilter("JapanAnime", "JapanAnime"),
    CheckFilter("Jumondou", "Jumondou"),
    CheckFilter("Kitty Media", "Kitty Media"),
    CheckFilter("Lune Pictures", "Lune Pictures"),
    CheckFilter("MS Pictures", "MS Pictures"),
    CheckFilter("Magic Bus", "Magic Bus"),
    CheckFilter("Magin Label", "Magin Label"),
    CheckFilter("Majin Petit", "Majin Petit"),
    CheckFilter("Majin petit", "Majin petit"),
    CheckFilter("Majin", "Majin"),
    CheckFilter("Mary Jane", "Mary Jane"),
    CheckFilter("Mediabank", "Mediabank"),
    CheckFilter("Milky Animation Label", "Milky Animation Label"),
    CheckFilter("Mirai Koujou", "Mirai Koujou"),
    CheckFilter("NBCUniversal Entertainment Japan", "NBCUniversal Entertainment Japan"),
    CheckFilter("Natural High", "Natural High"),
    CheckFilter("NewGeneration", "NewGeneration"),
    CheckFilter("Nippon Columbia", "Nippon Columbia"),
    CheckFilter("Nur", "Nur"),
    CheckFilter("Office Nobu", "Office Nobu"),
    CheckFilter("Pashima", "Pashima"),
    CheckFilter("Pashmina", "Pashmina"),
    CheckFilter("Passione", "Passione"),
    CheckFilter("Peak Hunt", "Peak Hunt"),
    CheckFilter("Pink Pineapple", "Pink Pineapple"),
    CheckFilter("PoRO petit", "PoRO petit"),
    CheckFilter("PoRO", "PoRO"),
    CheckFilter("Queen Bee", "Queen Bee"),
    CheckFilter("Rabbit Gate", "Rabbit Gate"),
    CheckFilter("Seven", "Seven"),
    CheckFilter("Shion", "Shion"),
    CheckFilter("Show-Ten", "Show-Ten"),
    CheckFilter("Shueisha", "Shueisha"),
    CheckFilter("Studio 1st", "Studio 1st"),
    CheckFilter("Studio Gokumi", "Studio Gokumi"),
    CheckFilter("Studio Houkiboshi", "Studio Houkiboshi"),
    CheckFilter("Suzuki Mirano", "Suzuki Mirano"),
    CheckFilter("T-Rex", "T-Rex"),
    CheckFilter("TEATRO Nishi Tokyo Studio", "TEATRO Nishi Tokyo Studio"),
    CheckFilter("TNK", "TNK"),
    CheckFilter("Toranoana", "Toranoana"),
    CheckFilter("WHITE BEAR", "WHITE BEAR"),
    CheckFilter("Y.O.U.C", "Y.O.U.C"),
    CheckFilter("YTV", "YTV"),
    CheckFilter("Yomiuri TV Enterprise", "Yomiuri TV Enterprise"),
    CheckFilter("ZIZ Entertainment", "ZIZ Entertainment"),
    CheckFilter("erozuki", "erozuki"),
)

class StudioListFilter(studios: List<CheckFilter>) : AnimeFilter.Group<CheckFilter>("Studio", studios)

val FILTERS: AnimeFilterList get() = AnimeFilterList(
    OrderByFilter(),
    GenreListFilter(getGenreList()),
    StudioListFilter(getStudioList()),
)
