package cl.homelogic.platform.designsystem.foundations

import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color

@Immutable
sealed interface Palette {
    val name: String
    val color: Color

    sealed class Mono : Palette {
        data object At0 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFFFFFFFF)
        }

        data object At200 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFFF2F3F5)
        }

        data object At250 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFFDBE0E5)
        }

        data object At300 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFFC2C3C5)
        }

        data object At400 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF9A9CA0)
        }

        data object At500 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF78828D)
        }

        data object At600 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF637587)
        }

        data object At750 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF48525D)
        }

        data object At800 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF3D4754)
        }

        data object At850 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF38383D)
        }

        data object At900 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF293038)
        }

        data object At950 : Mono() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF121417)
        }
    }

    sealed class Brand : Palette {
        data object Phoebe : Brand() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF10d48e)
        }

        data object Joey : Brand() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF0fc081)
        }

        data object Monica : Brand() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF132a3a)
        }

        data object Chandler : Brand() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF1c3c52)
        }
    }

    sealed class Sky : Palette {
        data object Clear : Sky() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF197fe6)
        }

        data object Deep : Sky() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF005CAC)
        }
    }

    sealed class Hazard : Palette {
        data object Fire : Hazard() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFFC34836)
        }
    }

    sealed class Sunset : Palette {
        data object Dawn : Sunset() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFFF49E4E)
        }

        data object Sunny : Sunset() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFFFFA255)
        }

        data object Dusk : Sunset() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFFF5824E)
        }

        data object Evening : Sunset() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFFE07648)
        }

        data object Twilight : Sunset() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF4E3151)
        }

        data object Night : Sunset() {
            override val name: String = this.toString()
            override val color: Color = Color(0xFF191538)
        }
    }

    companion object {
        fun getMonoColors(): List<Mono> =
            listOf(
                Mono.At0,
                Mono.At200,
                Mono.At250,
                Mono.At300,
                Mono.At400,
                Mono.At500,
                Mono.At600,
                Mono.At750,
                Mono.At800,
                Mono.At850,
                Mono.At900,
                Mono.At950,
            )

        fun getBrandColors(): List<Brand> =
            listOf(
                Brand.Phoebe,
                Brand.Joey,
                Brand.Monica,
                Brand.Chandler,
            )

        fun getSkyColors(): List<Sky> =
            listOf(
                Sky.Clear,
                Sky.Deep,
            )

        fun getHazardColors(): List<Hazard> =
            listOf(
                Hazard.Fire,
            )

        fun getSunsetColors(): List<Sunset> =
            listOf(
                Sunset.Dawn,
                Sunset.Sunny,
                Sunset.Dusk,
                Sunset.Evening,
                Sunset.Twilight,
                Sunset.Night,
            )

        fun getAllColors(): List<Palette> =
            listOf(
                getMonoColors(),
                getBrandColors(),
                getSkyColors(),
                getHazardColors(),
                getSunsetColors(),
            ).flatten()
    }
}
