package ch.dissem.yaep.ui.common

import ch.dissem.yaep.domain.Animal
import ch.dissem.yaep.domain.Dessert
import ch.dissem.yaep.domain.Drink
import ch.dissem.yaep.domain.Fruit
import ch.dissem.yaep.domain.ItemClass
import ch.dissem.yaep.domain.Nationality
import ch.dissem.yaep.domain.Profession
import ch.dissem.yaep.domain.Transportation
import org.jetbrains.compose.resources.StringResource
import yaep.commonui.generated.resources.Res
import yaep.commonui.generated.resources.ant
import yaep.commonui.generated.resources.astronaut
import yaep.commonui.generated.resources.banana
import yaep.commonui.generated.resources.beverage
import yaep.commonui.generated.resources.bicycle
import yaep.commonui.generated.resources.british
import yaep.commonui.generated.resources.bubble_tea
import yaep.commonui.generated.resources.bus
import yaep.commonui.generated.resources.cake
import yaep.commonui.generated.resources.canadian
import yaep.commonui.generated.resources.cherries
import yaep.commonui.generated.resources.chocolate
import yaep.commonui.generated.resources.coffee
import yaep.commonui.generated.resources.cookie
import yaep.commonui.generated.resources.cupcake
import yaep.commonui.generated.resources.custard
import yaep.commonui.generated.resources.dog
import yaep.commonui.generated.resources.doughnut
import yaep.commonui.generated.resources.farmer
import yaep.commonui.generated.resources.firefighter
import yaep.commonui.generated.resources.goat
import yaep.commonui.generated.resources.grapes
import yaep.commonui.generated.resources.health_worker
import yaep.commonui.generated.resources.ice_cream
import yaep.commonui.generated.resources.japanese
import yaep.commonui.generated.resources.kiwi
import yaep.commonui.generated.resources.lemon
import yaep.commonui.generated.resources.locomotive
import yaep.commonui.generated.resources.lollipop
import yaep.commonui.generated.resources.mango
import yaep.commonui.generated.resources.mate
import yaep.commonui.generated.resources.milk
import yaep.commonui.generated.resources.motor_scooter
import yaep.commonui.generated.resources.norwegian
import yaep.commonui.generated.resources.octopus
import yaep.commonui.generated.resources.pear
import yaep.commonui.generated.resources.pie
import yaep.commonui.generated.resources.pineapple
import yaep.commonui.generated.resources.rock_star
import yaep.commonui.generated.resources.scientist
import yaep.commonui.generated.resources.skateboard
import yaep.commonui.generated.resources.sloth
import yaep.commonui.generated.resources.snail
import yaep.commonui.generated.resources.software_dev
import yaep.commonui.generated.resources.spanish
import yaep.commonui.generated.resources.strawberry
import yaep.commonui.generated.resources.swedish
import yaep.commonui.generated.resources.swiss
import yaep.commonui.generated.resources.taxi
import yaep.commonui.generated.resources.tea
import yaep.commonui.generated.resources.teacher
import yaep.commonui.generated.resources.tram_car
import yaep.commonui.generated.resources.ukrainian
import yaep.commonui.generated.resources.water
import yaep.commonui.generated.resources.watermelon
import yaep.commonui.generated.resources.zebra

val ItemClass<*>.localName: StringResource
    get() = when (this) {
        is Animal -> this.stringResource
        is Dessert -> this.stringResource
        is Drink -> this.stringResource
        is Fruit -> this.stringResource
        is Nationality -> this.stringResource
        is Profession -> this.stringResource
        is Transportation -> this.stringResource
    }

private val Animal.stringResource: StringResource
    get() = when (this) {
        Animal.ANT -> Res.string.ant
        Animal.DOG -> Res.string.dog
        Animal.GOAT -> Res.string.goat
        Animal.OCTOPUS -> Res.string.octopus
        Animal.SLOTH -> Res.string.sloth
        Animal.SNAIL -> Res.string.snail
        Animal.ZEBRA -> Res.string.zebra
    }

private val Dessert.stringResource: StringResource
    get() = when (this) {
        Dessert.CAKE -> Res.string.cake
        Dessert.CHOCOLATE -> Res.string.chocolate
        Dessert.COOKIE -> Res.string.cookie
        Dessert.CUPCAKE -> Res.string.cupcake
        Dessert.CUSTARD -> Res.string.custard
        Dessert.DOUGHNUT -> Res.string.doughnut
        Dessert.ICE_CREAM -> Res.string.ice_cream
        Dessert.LOLLIPOP -> Res.string.lollipop
        Dessert.PIE -> Res.string.pie
    }

private val Drink.stringResource: StringResource
    get() = when (this) {
        Drink.BEVERAGE -> Res.string.beverage
        Drink.BUBBLE_TEA -> Res.string.bubble_tea
        Drink.COFFEE -> Res.string.coffee
        Drink.MATE -> Res.string.mate
        Drink.MILK -> Res.string.milk
        Drink.TEA -> Res.string.tea
        Drink.WATER -> Res.string.water
    }

private val Fruit.stringResource: StringResource
    get() = when (this) {
        Fruit.BANANA -> Res.string.banana
        Fruit.CHERRIES -> Res.string.cherries
        Fruit.GRAPES -> Res.string.grapes
        Fruit.KIWI -> Res.string.kiwi
        Fruit.LEMON -> Res.string.lemon
        Fruit.MANGO -> Res.string.mango
        Fruit.PEAR -> Res.string.pear
        Fruit.PINEAPPLE -> Res.string.pineapple
        Fruit.STRAWBERRY -> Res.string.strawberry
        Fruit.WATERMELON -> Res.string.watermelon
    }

private val Nationality.stringResource: StringResource
    get() = when (this) {
        Nationality.CANADA -> Res.string.canadian
        Nationality.JAPAN -> Res.string.japanese
        Nationality.NORWAY -> Res.string.norwegian
        Nationality.SPAIN -> Res.string.spanish
        Nationality.SWEDEN -> Res.string.swedish
        Nationality.SWITZERLAND -> Res.string.swiss
        Nationality.UNITED_KINGDOM -> Res.string.british
        Nationality.UKRAINE -> Res.string.ukrainian
    }

private val Profession.stringResource: StringResource
    get() = when (this) {
        Profession.ASTRONAUT -> Res.string.astronaut
        Profession.FARMER -> Res.string.farmer
        Profession.FIREFIGHTER -> Res.string.firefighter
        Profession.HEALTH_WORKER -> Res.string.health_worker
        Profession.ROCK_STAR -> Res.string.rock_star
        Profession.SCIENTIST -> Res.string.scientist
        Profession.SOFTWARE_DEV -> Res.string.software_dev
        Profession.TEACHER -> Res.string.teacher
    }

private val Transportation.stringResource: StringResource
    get() = when (this) {
        Transportation.BICYCLE -> Res.string.bicycle
        Transportation.BUS -> Res.string.bus
        Transportation.LOCOMOTIVE -> Res.string.locomotive
        Transportation.MOTOR_SCOOTER -> Res.string.motor_scooter
        Transportation.SKATEBOARD -> Res.string.skateboard
        Transportation.TAXI -> Res.string.taxi
        Transportation.TRAM_CAR -> Res.string.tram_car
    }