from enum import Enum
from typing import List


class EpcRoofDescriptions(Enum):
    # Loft
    # Assumed options
    pitched_insulated_assumed: str = "Pitched, insulated (assumed)"
    pitched_no_insulation: str = "Pitched, no insulation"
    # Insulation thickness options
    loft_12mm_insulation: str = "Pitched, 12 mm loft insulation"
    loft_25mm_insulation: str = "Pitched, 25 mm loft insulation"
    loft_50mm_insulation: str = "Pitched, 50 mm loft insulation"
    loft_75mm_insulation: str = "Pitched, 75 mm loft insulation"
    loft_100mm_insulation: str = "Pitched, 100 mm loft insulation"
    loft_125mm_insulation: str = "Pitched, 125 mm loft insulation"
    loft_150mm_insulation: str = "Pitched, 150 mm loft insulation"
    loft_175mm_insulation: str = "Pitched, 175 mm loft insulation"
    loft_200mm_insulation: str = "Pitched, 200 mm loft insulation"
    loft_250mm_insulation: str = "Pitched, 250 mm loft insulation"
    loft_270mm_insulation: str = "Pitched, 270 mm loft insulation"
    loft_300mm_insulation: str = "Pitched, 300 mm loft insulation"
    loft_350mm_insulation: str = "Pitched, 350 mm loft insulation"
    loft_400mm_plus_insulation: str = "Pitched, 400+ mm loft insulation"
    # Insulated at rafters "Pitched, insulated at rafters"
    # Rafters
    # 400mm, 350mm = very good
    # 200-300mm = good
    # 125-175 = average
    # 50-100 = poor
    # 25 and below= very poor
    loft_insulated_at_rafters: str = "Pitched, insulated at rafters"
    # another dwelling above
    another_dwelling_above: str = "(another dwelling above)"
    # flat roof, which if there is observed insulation is just "flat, insulated", however there is a
    # different efficiency rating depending on insulation thickness
    # categories:
    # 12mm = very poor & has limited insulation description
    # 25, 50 = poor & has limited insulation description
    # 75, 100, 125mm = average (Flat, insulated)
    # 150, 175, 200, 225, 250mm = good (Flat, insulated)
    # 270mm+ = very good (Flat, insulated)
    # As built 2023 = Flat, insulated, Very good
    # 2003 - 2006, up to 2012-2022 = Flat insulated, Good
    # 1983-1990, 1996-2002 = Flat, insulated, Average
    # 1976-1982 = Flat, limited insulation, poor
    # 1967 - 1975 = Flat, limited insulation, Very Poor
    # 1950-1966 and earlier bands = flat, no insulation, very poor

    flat_insulated: str = "Flat, insulated"
    flat_limited_insulation: str = "Flat, limited insulation"
    flat_no_insulation: str = "Flat, no insulation"

    # Thatched roof descriptions
    # With Loft insulation at joists
    # Thatched + 12mm = thatched, with additional insulation, average
    # Thatched + 25, 50, 100, 150mm = thatched, with additional insulation, good
    # Thatched + 175mm+ = thatched, with additional insulation, very good
    # With loft insulation at rafters [out of scope atm]
    # Unknown insulation
    # Pre 1900, 1930-1949, 1967-1975, 1983-1990, 1996-2002 = "Thatched", Average
    # 2003-2006, 2012-2022 = "Thatched", Good
    # 2023 onwards = "Thatched", Very Good
    thatched: str = "Thatched"  # We see this for no insulation, has average performance
    thatched_with_additional_insulation: str = "Thatched, with additional insulation"

    # Sloping ceiling
    # For sloping ceiling tags, we don't use any (assumed) tags so that it's unambiguous that the roof is sloped
    sloping_pitched_no_insulation: str = "Pitched, no insulation"
    sloping_pitched_limited_insulation: str = "Pitched, limited insulation"
    sloping_pitched_insulated: str = "Pitched, insulated"

    # Unknown descriptions which may get mapped later or handled via fallback
    flat_as_built_unknown: str = "Flat, as built, unknown insulation"
    loft_as_built_unknown: str = "Loft, as built, unknown insulation"
    thatched_as_built_unknown: str = "Thatched, as built, unknown insulation"
    sloping_pitched_as_built_unknown: str = "Pitched, as built, unknown insulation"

    @property
    def unknown_descriptions(self) -> List["EpcRoofDescriptions"]:
        return [
            EpcRoofDescriptions.flat_as_built_unknown,
            EpcRoofDescriptions.loft_as_built_unknown,
            EpcRoofDescriptions.thatched_as_built_unknown,
            EpcRoofDescriptions.sloping_pitched_as_built_unknown,
        ]
