from backend.condition.domain.element_type import ElementType
from backend.condition.domain.aspect_type import AspectType
from backend.condition.domain.mapping.element_mapping import ElementMapping


LBWF_ELEMENT_MAP: dict[str, ElementMapping] = {
    # ==========================================================
    # PROPERTY / GENERAL
    # ==========================================================
    "AHR_CAT": ElementMapping(
        elementType=ElementType.ACCESSIBLE_HOUSING_REGISTER,
        aspect_type=AspectType.CATEGORY,
    ),
    "ASSETSAREA": ElementMapping(
        elementType=ElementType.PROPERTY,
        aspect_type=AspectType.AREA,
    ),
    # "DECNTHMINC": ElementMapping(
    #     element=Element.DECENT_HOMES,
    #     aspect_type=AspectType.INCLUSION,
    # ), # Ignore this one
    "QUALITYSTD": ElementMapping(
        elementType=ElementType.QUALITY_STANDARD,
        aspect_type=AspectType.TYPE,
    ),
    "EXTSTOREY": ElementMapping(
        elementType=ElementType.PROPERTY,
        aspect_type=AspectType.CONFIGURATION,
    ),
    "FLVL": ElementMapping(
        elementType=ElementType.FLOOR_LEVEL_FRONT_DOOR,
        aspect_type=AspectType.LOCATION,
    ),
    "INTFLRLVL": ElementMapping(
        elementType=ElementType.FLOOR_LEVEL,
        aspect_type=AspectType.LOCATION,
    ),
    "INTNSEINSL": ElementMapping(
        elementType=ElementType.EXTERNAL_NOISE_INSULATION,  # Maybe this shouldn't be "EXTERNAL_"
        aspect_type=AspectType.ADEQUACY,
    ),
    "INTSTEPSFD": ElementMapping(
        elementType=ElementType.STEPS_TO_FRONT_DOOR,
        aspect_type=AspectType.QUANTITY,
    ),
    # ==========================================================
    # ASBESTOS (NON-HHSRS RECORD)
    # ==========================================================
    "ASBESTOS": ElementMapping(
        elementType=ElementType.ASBESTOS,
        aspect_type=AspectType.PRESENCE,
    ),
    # ==========================================================
    # INTERNAL – BATHROOMS & KITCHENS
    # ==========================================================
    "INTBTHRLOC": ElementMapping(
        elementType=ElementType.BATHROOM,
        aspect_type=AspectType.LOCATION,
    ),
    "INTBTHADEQ": ElementMapping(
        elementType=ElementType.BATHROOM,
        aspect_type=AspectType.ADEQUACY,
    ),
    "INTKITADEQ": ElementMapping(
        elementType=ElementType.KITCHEN,
        aspect_type=AspectType.ADEQUACY,
    ),
    "INTCKRLOC": ElementMapping(
        elementType=ElementType.KITCHEN,
        aspect_type=AspectType.LOCATION,
    ),
    "INTADDWCW": ElementMapping(
        elementType=ElementType.ADDITIONAL_WC_OR_WHB,
        aspect_type=AspectType.PRESENCE,
    ),
    "INTBTHREML": ElementMapping(
        elementType=ElementType.BATHROOM_REMAINING_LIFE_SOURCE,
        aspect_type=AspectType.TYPE,
    ),
    "INTKITREML": ElementMapping(
        elementType=ElementType.KITCHEN_REMAINING_LIFE_SOURCE,
        aspect_type=AspectType.TYPE,
    ),
    "INTTNTINST": ElementMapping(
        elementType=ElementType.TENANT_INSTALLED_KITCHEN,
        aspect_type=AspectType.TYPE,  # Not certain about this aspect type - need more data
    ),
    # ==========================================================
    # INTERNAL – FIRE
    # ==========================================================
    "FRARISKRTG": ElementMapping(
        elementType=ElementType.FIRE_RISK_ASSESSMENT,
        aspect_type=AspectType.RATING,
    ),
    "FRATYPE": ElementMapping(
        elementType=ElementType.FIRE_RISK_ASSESSMENT,
        aspect_type=AspectType.TYPE,
    ),
    "FRAEVACSTR": ElementMapping(
        elementType=ElementType.FIRE_RISK_ASSESSMENT,
        aspect_type=AspectType.STRATEGY,
    ),
    "INTSMKDET": ElementMapping(
        elementType=ElementType.SMOKE_DETECTION,
        aspect_type=AspectType.PRESENCE,
    ),
    "INTCHEXTNT": ElementMapping(
        elementType=ElementType.HEATING_SYSTEM,
        aspect_type=AspectType.EXTENT,
    ),
    # ==========================================================
    # HEATING & SERVICES
    # ==========================================================
    "INTCHEXTNT": ElementMapping(
        elementType=ElementType.CENTRAL_HEATING,
        aspect_type=AspectType.EXTENT,
    ),
    "INTCHDIST": ElementMapping(
        elementType=ElementType.HEATING_DISTRIBUTION,
        aspect_type=AspectType.TYPE,
    ),
    "INTCHBLR": ElementMapping(
        elementType=ElementType.HEATING_BOILER,
        aspect_type=AspectType.TYPE,
    ),
    "INTBOILERF": ElementMapping(
        elementType=ElementType.BOILER_FUEL,
        aspect_type=AspectType.TYPE,
    ),
    "INTHTDISYS": ElementMapping(
        elementType=ElementType.HEATING_SYSTEM,
        aspect_type=AspectType.DISTRIBUTION,
    ),
    "INTWTRHTNG": ElementMapping(
        elementType=ElementType.WATER_HEATING,
        aspect_type=AspectType.TYPE,
    ),
    "INTCOMHTG": ElementMapping(
        elementType=ElementType.COMMUNITY_HEATING,
        aspect_type=AspectType.TYPE,
    ),
    "INTELECTRC": ElementMapping(
        elementType=ElementType.ELECTRICS,
        aspect_type=AspectType.WORK_REQUIRED,  # Not certain about this aspect type - need more data
    ),
    "INTGASAVAI": ElementMapping(
        elementType=ElementType.GAS_AVAILABLE,
        aspect_type=AspectType.PRESENCE,  # Maybe should be AspectType.TYPE ?
    ),
    "INTHEATREC": ElementMapping(
        elementType=ElementType.HEAT_RECOVERY_UNITS,
        aspect_type=AspectType.PRESENCE,
    ),
    "INTHTIMP": ElementMapping(
        elementType=ElementType.GAS_AVAILABLE,
        aspect_type=AspectType.WORK_REQUIRED,
    ),
    "INTPROGHTG": ElementMapping(
        elementType=ElementType.PROGRAMMABLE_HEATING,
        aspect_type=AspectType.TYPE,  # Should maybe be PRESENCE, but set to TYPE for consistency with Peabody data
    ),
    # ==========================================================
    # EXTERNAL – WALLS (INSTANCED)
    # ==========================================================
    "EXTWALLSTR": ElementMapping(
        elementType=ElementType.EXTERNAL_WALL,
        aspect_type=AspectType.STRUCTURE,
    ),
    "EXTWALLFN1": ElementMapping(
        elementType=ElementType.EXTERNAL_WALL,
        aspect_type=AspectType.FINISH,
    ),
    "EXTWALLFN2": ElementMapping(
        elementType=ElementType.EXTERNAL_WALL,
        aspect_type=AspectType.FINISH,
        aspect_instance=2,
    ),
    "EXTWALLINS": ElementMapping(
        elementType=ElementType.EXTERNAL_WALL,
        aspect_type=AspectType.INSULATION,
    ),
    "EXTWALLSPL": ElementMapping(
        elementType=ElementType.EXTERNAL_WALL,
        aspect_type=AspectType.CONDITION,
    ),
    "EXTDWNPTYP": ElementMapping(
        elementType=ElementType.DOWNPIPES,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTGUTRTYP": ElementMapping(
        elementType=ElementType.GUTTERS,
        aspect_type=AspectType.MATERIAL,
    ),
    # ==========================================================
    # EXTERNAL – ROOFS (INSTANCED)
    # ==========================================================
    "EXTRFSTR1": ElementMapping(
        elementType=ElementType.ROOF,
        aspect_type=AspectType.STRUCTURE,
    ),
    "EXTRFSTR2": ElementMapping(
        elementType=ElementType.ROOF,
        aspect_type=AspectType.STRUCTURE,
        aspect_instance=2,
    ),
    "EXTRFSTR3": ElementMapping(
        elementType=ElementType.ROOF,
        aspect_type=AspectType.STRUCTURE,
        aspect_instance=3,
    ),
    "EXTROOF1": ElementMapping(
        elementType=ElementType.ROOF,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTROOF2": ElementMapping(
        elementType=ElementType.ROOF,
        aspect_type=AspectType.MATERIAL,
        aspect_instance=2,
    ),
    "EXTROOF3": ElementMapping(
        elementType=ElementType.ROOF,
        aspect_type=AspectType.MATERIAL,
        aspect_instance=3,
    ),
    "EXTCHIMNEY": ElementMapping(
        elementType=ElementType.CHIMNEY,
        aspect_type=AspectType.WORK_REQUIRED,
    ),
    "EXTFASOFBR": ElementMapping(
        elementType=ElementType.FASCIA_SOFFIT_BARGEBOARDS,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTGARROOF": ElementMapping(
        elementType=ElementType.GARAGE_ROOF,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTGARSTRF": ElementMapping(
        elementType=ElementType.GARAGE_AND_STORE_ROOF,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTSTRROOF": ElementMapping(
        elementType=ElementType.STORE_ROOF,
        aspect_type=AspectType.MATERIAL,
    ),
    "INTLOFTINS": ElementMapping(
        elementType=ElementType.LOFT_INSULATION,
        aspect_type=AspectType.TYPE,
    ),
    # ==========================================================
    # EXTERNAL – DOORS & WINDOWS
    # ==========================================================
    "INTFRDOOR": ElementMapping(
        elementType=ElementType.EXTERNAL_DOOR,
        aspect_type=AspectType.TYPE,
    ),
    "INTFRDRFRR": ElementMapping(
        elementType=ElementType.EXTERNAL_DOOR,
        aspect_type=AspectType.FIRE_RATING,
    ),
    "EXTBKSDDR1": ElementMapping(
        elementType=ElementType.EXTERNAL_DOOR,
        aspect_type=AspectType.TYPE,
    ),
    "EXTBKSDDR2": ElementMapping(
        elementType=ElementType.EXTERNAL_DOOR,
        aspect_type=AspectType.TYPE,
        aspect_instance=2,
    ),
    "INTWDWTYPE": ElementMapping(
        elementType=ElementType.EXTERNAL_WINDOWS,
        aspect_type=AspectType.TYPE,
    ),
    "EXTWNDWS1": ElementMapping(
        elementType=ElementType.EXTERNAL_WINDOWS,
        aspect_type=AspectType.TYPE,
    ),
    "EXTWNDWS2": ElementMapping(
        elementType=ElementType.EXTERNAL_WINDOWS,
        aspect_type=AspectType.TYPE,
        aspect_instance=2,
    ),
    "EXTGARDOOR": ElementMapping(
        elementType=ElementType.GARAGE_DOOR,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTGARSTDR": ElementMapping(
        elementType=ElementType.GARAGE_AND_STORE_DOOR,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTSTRDOOR": ElementMapping(
        elementType=ElementType.STORE_DOOR,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTGARWDWS": ElementMapping(
        elementType=ElementType.GARAGE_WINDOWS,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTSTRWDWS": ElementMapping(
        elementType=ElementType.STORE_WINDOWS,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTGARSTWD": ElementMapping(
        elementType=ElementType.GARAGE_AND_STORE_WINDOWS,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTLINTELS": ElementMapping(
        elementType=ElementType.LINTEL,
        aspect_type=AspectType.PRESENCE,
    ),
    "EXTPTFRDR1": ElementMapping(
        elementType=ElementType.PATIO_FRENCH_DOOR,
        aspect_type=AspectType.MATERIAL,
    ),
    # ==========================================================
    # EXTERNAL AREAS
    # ==========================================================
    "EXTBALCONY": ElementMapping(
        elementType=ElementType.PRIVATE_BALCONY,
        aspect_type=AspectType.PRESENCE,
    ),
    "EXTBPOINTG": ElementMapping(
        elementType=ElementType.EXTERNAL_BRICKWORK_POINTING,
        aspect_type=AspectType.PRESENCE,
    ),
    "EXTDRPKERB": ElementMapping(
        elementType=ElementType.DROP_KERB,
        aspect_type=AspectType.PRESENCE,
    ),
    "EXTEXTDECS": ElementMapping(
        elementType=ElementType.EXTERNAL_DECORATION,
        aspect_type=AspectType.PRESENCE,
    ),
    "EXTHARDSTD": ElementMapping(
        elementType=ElementType.PATHS_AND_HARDSTANDINGS,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTINTDWNP": ElementMapping(
        elementType=ElementType.INTERNAL_DOWNPIPES_EXTERNAL_AREA,
        aspect_type=AspectType.MATERIAL,
    ),
    "EXTOUTBOH": ElementMapping(
        elementType=ElementType.OUTBUILDING_OVERHAUL,
        aspect_type=AspectType.TYPE,
    ),
    "EXTPARKING": ElementMapping(
        elementType=ElementType.PARKING_AREAS,
        aspect_type=AspectType.PRESENCE,
    ),
    "EXTPCHCNPY": ElementMapping(
        elementType=ElementType.PORCH_CANOPY,
        aspect_type=AspectType.TYPE,
    ),
    "EXTSTRINSP": ElementMapping(
        elementType=ElementType.EXTERNAL_STRUCTURAL_DEFECTS,
        aspect_type=AspectType.TYPE,  # Need more sample data to know whether this is the correct aspect type
    ),
    "INTACCRAMP": ElementMapping(
        elementType=ElementType.ACCESS_RAMP,
        aspect_type=AspectType.TYPE,  # # Need more sample data to know whether this is the correct aspect type
    ),
    # ======================
    # FITNESS FOR HUMAN HABITATION
    # ======================
    "FFHHDAMP": ElementMapping(
        elementType=ElementType.FFHH_DAMP,
        aspect_type=AspectType.RISK,
    ),
    "FFHHHCWAT": ElementMapping(
        elementType=ElementType.FFHH_HOT_AND_COLD_WATER,
        aspect_type=AspectType.RISK,
    ),
    "FFHHDRNWC": ElementMapping(
        elementType=ElementType.FFHH_DRAINAGE_LAVATORIES,
        aspect_type=AspectType.RISK,
    ),
    "FFHHNEGLC": ElementMapping(
        elementType=ElementType.FFHH_NEGLECTED,
        aspect_type=AspectType.RISK,
    ),
    "FFHHNONAT": ElementMapping(
        elementType=ElementType.FFHH_NATURAL_LIGHT,
        aspect_type=AspectType.RISK,
    ),
    "FFHHNOVEN": ElementMapping(
        elementType=ElementType.FFHH_VENTILATION,
        aspect_type=AspectType.RISK,
    ),
    "FFHHPRPCK": ElementMapping(
        elementType=ElementType.FFHH_FOOD_PREP_AND_WASHUP,
        aspect_type=AspectType.RISK,
    ),
    "FFHHUNLAY": ElementMapping(
        elementType=ElementType.FFHH_UNSAFE_LAYOUT,
        aspect_type=AspectType.RISK,
    ),
    "FFHHUNSTA": ElementMapping(
        elementType=ElementType.FFHH_UNSTABLE_BUILDING,
        aspect_type=AspectType.RISK,
    ),
    # ==========================================================
    # HHSRS
    # ==========================================================
    "HHSRSDAMP": ElementMapping(
        elementType=ElementType.HHSRS_DAMP_AND_MOULD,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSCOLD": ElementMapping(
        elementType=ElementType.HHSRS_EXCESS_COLD,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSHEAT": ElementMapping(
        elementType=ElementType.HHSRS_EXCESS_HEAT,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSASB": ElementMapping(
        elementType=ElementType.HHSRS_ASBESTOS_AND_MMF,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSBIOC": ElementMapping(
        elementType=ElementType.HHSRS_BIOCIDES,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSCO": ElementMapping(
        elementType=ElementType.HHSRS_CARBON_MONOXIDE,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSNO2": ElementMapping(
        elementType=ElementType.HHSRS_CARBON_MONOXIDE,
        aspect_type=AspectType.RISK,
    ),  # Duplicate of HHSRSCO; I think they relate to the same HHSRS hazard
    "HHSRSSO2": ElementMapping(
        elementType=ElementType.HHSRS_CARBON_MONOXIDE,
        aspect_type=AspectType.RISK,
    ),  # Duplicate of HHSRSCO; I think they relate to the same HHSRS hazard
    "HHSRSLEAD": ElementMapping(
        elementType=ElementType.HHSRS_LEAD,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSRADIA": ElementMapping(
        elementType=ElementType.HHSRS_RADIATION,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSFUEL": ElementMapping(
        elementType=ElementType.HHSRS_UNCOMBUSTED_FUEL_GAS,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSORGAN": ElementMapping(
        elementType=ElementType.HHSRS_VOLATILE_ORGANIC_COMPOUNDS,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSCROWD": ElementMapping(
        elementType=ElementType.HHSRS_CROWDING_AND_SPACE,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSENTRY": ElementMapping(
        elementType=ElementType.HHSRS_ENTRY_BY_INTRUDERS,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSLIGHT": ElementMapping(
        elementType=ElementType.HHSRS_LIGHTING,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSNOISE": ElementMapping(
        elementType=ElementType.HHSRS_NOISE,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSDOMES": ElementMapping(
        elementType=ElementType.HHSRS_DOMESTIC_HYGIENE_PESTS_REFUSE,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSFOOD": ElementMapping(
        elementType=ElementType.HHSRS_FOOD_SAFETY,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSPERS": ElementMapping(
        elementType=ElementType.HHSRS_PERSONAL_HYGIENE_SANITATION,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSWATER": ElementMapping(
        elementType=ElementType.HHSRS_WATER_SUPPLY,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSFBATH": ElementMapping(
        elementType=ElementType.HHSRS_FALLS_ASSOCIATED_WITH_BATHS,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSFLEVE": ElementMapping(
        elementType=ElementType.HHSRS_FALLS_ON_LEVEL_SURFACES,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSFSTAI": ElementMapping(
        elementType=ElementType.HHSRS_FALLS_ON_STAIRS,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSFBETW": ElementMapping(
        elementType=ElementType.HHSRS_FALLS_BETWEEN_LEVELS,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSELEC": ElementMapping(
        elementType=ElementType.HHSRS_ELECTRICAL_HAZARDS,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSFIRE": ElementMapping(
        elementType=ElementType.HHSRS_FIRE,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSFLAME": ElementMapping(
        elementType=ElementType.HHSRS_FLAMES_HOT_SURFACES,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSENTRP": ElementMapping(
        elementType=ElementType.HHSRS_COLLISION_AND_ENTRAPMENT,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSEXPLO": ElementMapping(
        elementType=ElementType.HHSRS_EXPLOSIONS,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSSTRUC": ElementMapping(
        elementType=ElementType.HHSRS_STRUCTURAL_COLLAPSE,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSCLOW": ElementMapping(
        elementType=ElementType.HHSRS_COLLISION_AND_ENTRAPMENT,
        aspect_type=AspectType.RISK,
    ),
    "HHSRSPOSI": ElementMapping(
        elementType=ElementType.HHSRS_AMENITIES,
        aspect_type=AspectType.RISK,
    ),
}
