Skip to content

Schemas

Here you will find the specification for LCAx. The specification is provided both as JSON Schemas and Python classes with Pydantic.

LCAx

# generated by datamodel-codegen:
#   filename:  lcax.schema.json

from __future__ import annotations

from datetime import date
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from pydantic import BaseModel, ConfigDict, Field


class BuildingModelScope(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    building_services: bool
    external_works: bool
    facilitating_works: bool
    ff_e: bool
    finishes: bool
    substructure: bool
    superstructure_envelope: bool
    superstructure_frame: bool
    superstructure_internal_elements: bool


class BuildingType(Enum):
    RENOVATION = 'renovation'
    NEW = 'new'


class BuildingTypology(Enum):
    OFFICE = 'office'
    RESIDENTIAL = 'residential'
    PUBLIC = 'public'
    COMMERCIAL = 'commercial'
    INDUSTRIAL = 'industrial'
    INFRASTRUCTURE = 'infrastructure'
    AGRICULTURAL = 'agricultural'
    MIXEDUSE = 'mixeduse'
    OTHER = 'other'


class Classification(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: str
    name: str
    system: str


class Country(Enum):
    UNKNOWN = 'unknown'
    AFG = 'afg'
    ALA = 'ala'
    ALB = 'alb'
    DZA = 'dza'
    ASM = 'asm'
    AND_ = 'and'
    AGO = 'ago'
    AIA = 'aia'
    ATA = 'ata'
    ATG = 'atg'
    ARG = 'arg'
    ARM = 'arm'
    ABW = 'abw'
    AUS = 'aus'
    AUT = 'aut'
    AZE = 'aze'
    BHS = 'bhs'
    BHR = 'bhr'
    BGD = 'bgd'
    BRB = 'brb'
    BLR = 'blr'
    BEL = 'bel'
    BLZ = 'blz'
    BEN = 'ben'
    BMU = 'bmu'
    BTN = 'btn'
    BOL = 'bol'
    BES = 'bes'
    BIH = 'bih'
    BWA = 'bwa'
    BVT = 'bvt'
    BRA = 'bra'
    IOT = 'iot'
    BRN = 'brn'
    BGR = 'bgr'
    BFA = 'bfa'
    BDI = 'bdi'
    CPV = 'cpv'
    KHM = 'khm'
    CMR = 'cmr'
    CAN = 'can'
    CYM = 'cym'
    CAF = 'caf'
    TCD = 'tcd'
    CHL = 'chl'
    CHN = 'chn'
    CXR = 'cxr'
    CCK = 'cck'
    COL = 'col'
    COM = 'com'
    COG = 'cog'
    COD = 'cod'
    COK = 'cok'
    CRI = 'cri'
    CIV = 'civ'
    HRV = 'hrv'
    CUB = 'cub'
    CUW = 'cuw'
    CYP = 'cyp'
    CZE = 'cze'
    DNK = 'dnk'
    DJI = 'dji'
    DMA = 'dma'
    DOM = 'dom'
    ECU = 'ecu'
    EGY = 'egy'
    SLV = 'slv'
    GNQ = 'gnq'
    ERI = 'eri'
    EST = 'est'
    SWZ = 'swz'
    ETH = 'eth'
    FLK = 'flk'
    FRO = 'fro'
    FJI = 'fji'
    FIN = 'fin'
    FRA = 'fra'
    GUF = 'guf'
    PYF = 'pyf'
    ATF = 'atf'
    GAB = 'gab'
    GMB = 'gmb'
    GEO = 'geo'
    DEU = 'deu'
    GHA = 'gha'
    GIB = 'gib'
    GRC = 'grc'
    GRL = 'grl'
    GRD = 'grd'
    GLP = 'glp'
    GUM = 'gum'
    GTM = 'gtm'
    GGY = 'ggy'
    GIN = 'gin'
    GNB = 'gnb'
    GUY = 'guy'
    HTI = 'hti'
    HMD = 'hmd'
    VAT = 'vat'
    HND = 'hnd'
    HKG = 'hkg'
    HUN = 'hun'
    ISL = 'isl'
    IND = 'ind'
    IDN = 'idn'
    IRN = 'irn'
    IRQ = 'irq'
    IRL = 'irl'
    IMN = 'imn'
    ISR = 'isr'
    ITA = 'ita'
    JAM = 'jam'
    JPN = 'jpn'
    JEY = 'jey'
    JOR = 'jor'
    KAZ = 'kaz'
    KEN = 'ken'
    KIR = 'kir'
    PRK = 'prk'
    KOR = 'kor'
    KWT = 'kwt'
    KGZ = 'kgz'
    LAO = 'lao'
    LVA = 'lva'
    LBN = 'lbn'
    LSO = 'lso'
    LBR = 'lbr'
    LBY = 'lby'
    LIE = 'lie'
    LTU = 'ltu'
    LUX = 'lux'
    MAC = 'mac'
    MDG = 'mdg'
    MWI = 'mwi'
    MYS = 'mys'
    MDV = 'mdv'
    MLI = 'mli'
    MLT = 'mlt'
    MHL = 'mhl'
    MTQ = 'mtq'
    MRT = 'mrt'
    MUS = 'mus'
    MYT = 'myt'
    MEX = 'mex'
    FSM = 'fsm'
    MDA = 'mda'
    MCO = 'mco'
    MNG = 'mng'
    MNE = 'mne'
    MSR = 'msr'
    MAR = 'mar'
    MOZ = 'moz'
    MMR = 'mmr'
    NAM = 'nam'
    NRU = 'nru'
    NPL = 'npl'
    NLD = 'nld'
    NCL = 'ncl'
    NZL = 'nzl'
    NIC = 'nic'
    NER = 'ner'
    NGA = 'nga'
    NIU = 'niu'
    NFK = 'nfk'
    MKD = 'mkd'
    MNP = 'mnp'
    NOR = 'nor'
    OMN = 'omn'
    PAK = 'pak'
    PLW = 'plw'
    PSE = 'pse'
    PAN = 'pan'
    PNG = 'png'
    PRY = 'pry'
    PER = 'per'
    PHL = 'phl'
    PCN = 'pcn'
    POL = 'pol'
    PRT = 'prt'
    PRI = 'pri'
    QAT = 'qat'
    REU = 'reu'
    ROU = 'rou'
    RUS = 'rus'
    RWA = 'rwa'
    BLM = 'blm'
    SHN = 'shn'
    KNA = 'kna'
    LCA = 'lca'
    MAF = 'maf'
    SPM = 'spm'
    VCT = 'vct'
    WSM = 'wsm'
    SMR = 'smr'
    STP = 'stp'
    SAU = 'sau'
    SEN = 'sen'
    SRB = 'srb'
    SYC = 'syc'
    SLE = 'sle'
    SGP = 'sgp'
    SXM = 'sxm'
    SVK = 'svk'
    SVN = 'svn'
    SLB = 'slb'
    SOM = 'som'
    ZAF = 'zaf'
    SGS = 'sgs'
    SSD = 'ssd'
    ESP = 'esp'
    LKA = 'lka'
    SDN = 'sdn'
    SUR = 'sur'
    SJM = 'sjm'
    SWE = 'swe'
    CHE = 'che'
    SYR = 'syr'
    TWN = 'twn'
    TJK = 'tjk'
    TZA = 'tza'
    THA = 'tha'
    TLS = 'tls'
    TGO = 'tgo'
    TKL = 'tkl'
    TON = 'ton'
    TTO = 'tto'
    TUN = 'tun'
    TUR = 'tur'
    TKM = 'tkm'
    TCA = 'tca'
    TUV = 'tuv'
    UGA = 'uga'
    UKR = 'ukr'
    ARE = 'are'
    GBR = 'gbr'
    USA = 'usa'
    UMI = 'umi'
    URY = 'ury'
    UZB = 'uzb'
    VUT = 'vut'
    VEN = 'ven'
    VNM = 'vnm'
    VGB = 'vgb'
    VIR = 'vir'
    WLF = 'wlf'
    ESH = 'esh'
    YEM = 'yem'
    ZMB = 'zmb'
    ZWE = 'zwe'


class ExternalImpactData(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    format: str
    url: str
    version: Optional[str] = None


class GeneralEnergyClass(Enum):
    EXISTING = 'existing'
    STANDARD = 'standard'
    ADVANCED = 'advanced'
    UNKNOWN = 'unknown'


class ImpactCategoryKey(Enum):
    GWP = 'gwp'
    GWP_FOS = 'gwp_fos'
    GWP_BIO = 'gwp_bio'
    GWP_LUL = 'gwp_lul'
    ODP = 'odp'
    AP = 'ap'
    EP = 'ep'
    EP_FW = 'ep_fw'
    EP_MAR = 'ep_mar'
    EP_TER = 'ep_ter'
    POCP = 'pocp'
    ADPE = 'adpe'
    ADPF = 'adpf'
    PENRE = 'penre'
    PERE = 'pere'
    PERM = 'perm'
    PERT = 'pert'
    PENRT = 'penrt'
    PENRM = 'penrm'
    SM = 'sm'
    PM = 'pm'
    WDP = 'wdp'
    IRP = 'irp'
    ETP_FW = 'etp_fw'
    HTP_C = 'htp_c'
    HTP_NC = 'htp_nc'
    SQP = 'sqp'
    RSF = 'rsf'
    NRSF = 'nrsf'
    FW = 'fw'
    HWD = 'hwd'
    NHWD = 'nhwd'
    RWD = 'rwd'
    CRU = 'cru'
    MRF = 'mrf'
    MER = 'mer'
    EEE = 'eee'
    EET = 'eet'


class ImpactDataSource3(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    external_impact_data: ExternalImpactData = Field(..., alias='externalImpactData')


class InternalImpactData(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    path: str


class LifeCycleStage(Enum):
    A1A3 = 'a1a3'
    A4 = 'a4'
    A5 = 'a5'
    B1 = 'b1'
    B2 = 'b2'
    B3 = 'b3'
    B4 = 'b4'
    B5 = 'b5'
    B6 = 'b6'
    B7 = 'b7'
    C1 = 'c1'
    C2 = 'c2'
    C3 = 'c3'
    C4 = 'c4'
    D = 'd'


class Location(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    address: Optional[str] = None
    city: Optional[str] = None
    country: Country


class ProjectInfo2(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    infrastructure_info: Dict[str, str] = Field(..., alias='infrastructureInfo')


class ProjectPhase(Enum):
    DESIGN = 'design'
    ONGOING = 'ongoing'
    BUILT = 'built'
    OTHER = 'other'


class RoofType(Enum):
    FLAT = 'flat'
    PITCHED = 'pitched'
    SADDLE = 'saddle'
    PYRAMID = 'pyramid'
    OTHER = 'other'


class SoftwareInfo(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    calculation_type: Optional[str] = Field(None, alias='calculationType')
    goal_and_scope_definition: Optional[str] = Field(
        None, alias='goalAndScopeDefinition'
    )
    lca_software: str = Field(..., alias='lcaSoftware')


class Source(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    name: str
    url: Optional[str] = None


class Standard(Enum):
    EN15804A1 = 'en15804a1'
    EN15804A2 = 'en15804a2'
    UNKNOWN = 'unknown'


class SubType(Enum):
    GENERIC = 'generic'
    SPECIFIC = 'specific'
    INDUSTRY = 'industry'
    REPRESENTATIVE = 'representative'


class Unit(Enum):
    M = 'm'
    M2 = 'm2'
    M3 = 'm3'
    KG = 'kg'
    TONES = 'tones'
    PCS = 'pcs'
    L = 'l'
    M2R1 = 'm2r1'
    KM = 'km'
    TONES_KM = 'tones_km'
    UNKNOWN = 'unknown'


class ValueUnit(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    unit: Unit
    value: float


class AreaType(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    definition: str
    unit: Unit
    value: float


class BuildingInfo(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    building_completion_year: Optional[int] = Field(
        None, alias='buildingCompletionYear', ge=0
    )
    building_footprint: Optional[ValueUnit] = Field(None, alias='buildingFootprint')
    building_height: Optional[ValueUnit] = Field(None, alias='buildingHeight')
    building_mass: Optional[ValueUnit] = Field(None, alias='buildingMass')
    building_model_scope: Optional[BuildingModelScope] = Field(
        None, alias='buildingModelScope'
    )
    building_permit_year: Optional[int] = Field(None, alias='buildingPermitYear', ge=0)
    building_type: BuildingType = Field(..., alias='buildingType')
    building_typology: BuildingTypology = Field(..., alias='buildingTypology')
    building_users: Optional[int] = Field(None, alias='buildingUsers', ge=0)
    certifications: Optional[List[str]] = None
    energy_demand_electricity: Optional[float] = Field(
        None, alias='energyDemandElectricity'
    )
    energy_demand_heating: Optional[float] = Field(None, alias='energyDemandHeating')
    energy_supply_electricity: Optional[float] = Field(
        None, alias='energySupplyElectricity'
    )
    energy_supply_heating: Optional[float] = Field(None, alias='energySupplyHeating')
    exported_electricity: Optional[float] = Field(None, alias='exportedElectricity')
    floors_above_ground: int = Field(..., alias='floorsAboveGround', ge=0)
    floors_below_ground: Optional[int] = Field(None, alias='floorsBelowGround', ge=0)
    frame_type: Optional[str] = Field(None, alias='frameType')
    general_energy_class: GeneralEnergyClass = Field(..., alias='generalEnergyClass')
    gross_floor_area: Optional[AreaType] = Field(None, alias='grossFloorArea')
    heated_floor_area: Optional[AreaType] = Field(None, alias='heatedFloorArea')
    local_energy_class: Optional[str] = Field(None, alias='localEnergyClass')
    roof_type: RoofType = Field(..., alias='roofType')


class Conversion(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    meta_data: str = Field(..., alias='metaData')
    to: Unit
    value: float


class EPD(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    comment: Optional[str] = None
    conversions: Optional[List[Conversion]] = None
    declared_unit: Unit = Field(..., alias='declaredUnit')
    format_version: str = Field(..., alias='formatVersion')
    id: str
    impacts: Dict[str, Dict[str, Optional[float]]]
    location: Country
    meta_data: Optional[Dict[str, Any]] = Field(None, alias='metaData')
    name: str
    published_date: date = Field(..., alias='publishedDate')
    reference_service_life: Optional[int] = Field(
        None, alias='referenceServiceLife', ge=0
    )
    source: Optional[Source] = None
    standard: Standard
    subtype: SubType
    valid_until: date = Field(..., alias='validUntil')
    version: str


class ImpactDataSource1(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    epd: EPD = Field(..., alias='EPD')


class ImpactDataSource4(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    internal_impact_data: InternalImpactData = Field(..., alias='internalImpactData')


class ProjectInfo1(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    building_info: BuildingInfo = Field(..., alias='buildingInfo')


class TechFlow(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    comment: Optional[str] = None
    conversions: Optional[List[Conversion]] = None
    declared_unit: Unit = Field(..., alias='declaredUnit')
    format_version: str = Field(..., alias='formatVersion')
    id: str
    impacts: Dict[str, Dict[str, Optional[float]]]
    location: Country
    meta_data: Optional[Dict[str, Any]] = Field(None, alias='metaData')
    name: str
    source: Optional[Source] = None


class ImpactDataSource2(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    tech_flow: TechFlow = Field(..., alias='techFlow')


class Transport(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    distance: float
    distance_unit: Unit = Field(..., alias='distanceUnit')
    id: str
    name: str
    transport_epd: Union[
        ImpactDataSource1, ImpactDataSource2, ImpactDataSource3, ImpactDataSource4
    ] = Field(..., alias='transportEpd')


class Product(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    description: Optional[str] = None
    id: str
    impact_data: Union[
        ImpactDataSource1, ImpactDataSource2, ImpactDataSource3, ImpactDataSource4
    ] = Field(..., alias='impactData')
    meta_data: Optional[Dict[str, Any]] = Field(None, alias='metaData')
    name: str
    quantity: float
    reference_service_life: int = Field(..., alias='referenceServiceLife', ge=0)
    results: Optional[Dict[str, Any]] = None
    transport: Optional[Transport] = None
    unit: Unit


class Assembly(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    category: Optional[str] = None
    classification: Optional[List[Classification]] = None
    comment: Optional[str] = None
    description: Optional[str] = None
    id: str
    meta_data: Optional[Dict[str, Any]] = Field(None, alias='metaData')
    name: str
    products: Dict[str, Product]
    quantity: float
    results: Optional[Dict[str, Any]] = None
    unit: Unit


class Project(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    assemblies: Dict[str, Assembly]
    classification_system: Optional[str] = Field(None, alias='classificationSystem')
    comment: Optional[str] = None
    description: Optional[str] = None
    format_version: str = Field(..., alias='formatVersion')
    id: str
    impact_categories: List[ImpactCategoryKey] = Field(..., alias='impactCategories')
    lcia_method: Optional[str] = Field(None, alias='lciaMethod')
    life_cycle_stages: List[LifeCycleStage] = Field(..., alias='lifeCycleStages')
    location: Location
    meta_data: Optional[Dict[str, Any]] = Field(None, alias='metaData')
    name: str
    owner: Optional[str] = None
    project_info: Optional[Union[ProjectInfo1, ProjectInfo2]] = Field(
        None, alias='projectInfo'
    )
    project_phase: ProjectPhase = Field(..., alias='projectPhase')
    reference_study_period: Optional[int] = Field(
        None, alias='referenceStudyPeriod', ge=0
    )
    results: Optional[Dict[str, Any]] = None
    software_info: SoftwareInfo = Field(..., alias='softwareInfo')
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Project",
  "type": "object",
  "required": [
    "assemblies",
    "formatVersion",
    "id",
    "impactCategories",
    "lifeCycleStages",
    "location",
    "name",
    "projectPhase",
    "softwareInfo"
  ],
  "properties": {
    "assemblies": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/Assembly"
      }
    },
    "classificationSystem": {
      "type": [
        "string",
        "null"
      ]
    },
    "comment": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "formatVersion": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "impactCategories": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/ImpactCategoryKey"
      }
    },
    "lciaMethod": {
      "type": [
        "string",
        "null"
      ]
    },
    "lifeCycleStages": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/LifeCycleStage"
      }
    },
    "location": {
      "$ref": "#/definitions/Location"
    },
    "metaData": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      }
    },
    "name": {
      "type": "string"
    },
    "owner": {
      "type": [
        "string",
        "null"
      ]
    },
    "projectInfo": {
      "anyOf": [
        {
          "$ref": "#/definitions/ProjectInfo"
        },
        {
          "type": "null"
        }
      ]
    },
    "projectPhase": {
      "$ref": "#/definitions/ProjectPhase"
    },
    "referenceStudyPeriod": {
      "type": [
        "integer",
        "null"
      ],
      "format": "uint8",
      "minimum": 0.0
    },
    "results": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "object",
        "additionalProperties": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      }
    },
    "softwareInfo": {
      "$ref": "#/definitions/SoftwareInfo"
    }
  },
  "definitions": {
    "AreaType": {
      "type": "object",
      "required": [
        "definition",
        "unit",
        "value"
      ],
      "properties": {
        "definition": {
          "type": "string"
        },
        "unit": {
          "$ref": "#/definitions/Unit"
        },
        "value": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "Assembly": {
      "type": "object",
      "required": [
        "id",
        "name",
        "products",
        "quantity",
        "unit"
      ],
      "properties": {
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "classification": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Classification"
          }
        },
        "comment": {
          "type": [
            "string",
            "null"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "type": "string"
        },
        "metaData": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "products": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/Product"
          }
        },
        "quantity": {
          "type": "number",
          "format": "double"
        },
        "results": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "number",
                "null"
              ],
              "format": "double"
            }
          }
        },
        "unit": {
          "$ref": "#/definitions/Unit"
        }
      }
    },
    "BuildingInfo": {
      "type": "object",
      "required": [
        "buildingType",
        "buildingTypology",
        "floorsAboveGround",
        "generalEnergyClass",
        "roofType"
      ],
      "properties": {
        "buildingCompletionYear": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0.0
        },
        "buildingFootprint": {
          "anyOf": [
            {
              "$ref": "#/definitions/ValueUnit"
            },
            {
              "type": "null"
            }
          ]
        },
        "buildingHeight": {
          "anyOf": [
            {
              "$ref": "#/definitions/ValueUnit"
            },
            {
              "type": "null"
            }
          ]
        },
        "buildingMass": {
          "anyOf": [
            {
              "$ref": "#/definitions/ValueUnit"
            },
            {
              "type": "null"
            }
          ]
        },
        "buildingModelScope": {
          "anyOf": [
            {
              "$ref": "#/definitions/BuildingModelScope"
            },
            {
              "type": "null"
            }
          ]
        },
        "buildingPermitYear": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0.0
        },
        "buildingType": {
          "$ref": "#/definitions/BuildingType"
        },
        "buildingTypology": {
          "$ref": "#/definitions/BuildingTypology"
        },
        "buildingUsers": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0.0
        },
        "certifications": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "energyDemandElectricity": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "energyDemandHeating": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "energySupplyElectricity": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "energySupplyHeating": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "exportedElectricity": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "floorsAboveGround": {
          "type": "integer",
          "format": "uint16",
          "minimum": 0.0
        },
        "floorsBelowGround": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint16",
          "minimum": 0.0
        },
        "frameType": {
          "type": [
            "string",
            "null"
          ]
        },
        "generalEnergyClass": {
          "$ref": "#/definitions/GeneralEnergyClass"
        },
        "grossFloorArea": {
          "anyOf": [
            {
              "$ref": "#/definitions/AreaType"
            },
            {
              "type": "null"
            }
          ]
        },
        "heatedFloorArea": {
          "anyOf": [
            {
              "$ref": "#/definitions/AreaType"
            },
            {
              "type": "null"
            }
          ]
        },
        "localEnergyClass": {
          "type": [
            "string",
            "null"
          ]
        },
        "roofType": {
          "$ref": "#/definitions/RoofType"
        }
      }
    },
    "BuildingModelScope": {
      "type": "object",
      "required": [
        "building_services",
        "external_works",
        "facilitating_works",
        "ff_e",
        "finishes",
        "substructure",
        "superstructure_envelope",
        "superstructure_frame",
        "superstructure_internal_elements"
      ],
      "properties": {
        "building_services": {
          "type": "boolean"
        },
        "external_works": {
          "type": "boolean"
        },
        "facilitating_works": {
          "type": "boolean"
        },
        "ff_e": {
          "type": "boolean"
        },
        "finishes": {
          "type": "boolean"
        },
        "substructure": {
          "type": "boolean"
        },
        "superstructure_envelope": {
          "type": "boolean"
        },
        "superstructure_frame": {
          "type": "boolean"
        },
        "superstructure_internal_elements": {
          "type": "boolean"
        }
      }
    },
    "BuildingType": {
      "type": "string",
      "enum": [
        "renovation",
        "new"
      ]
    },
    "BuildingTypology": {
      "type": "string",
      "enum": [
        "office",
        "residential",
        "public",
        "commercial",
        "industrial",
        "infrastructure",
        "agricultural",
        "mixeduse",
        "other"
      ]
    },
    "Classification": {
      "type": "object",
      "required": [
        "code",
        "name",
        "system"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "system": {
          "type": "string"
        }
      }
    },
    "Conversion": {
      "type": "object",
      "required": [
        "metaData",
        "to",
        "value"
      ],
      "properties": {
        "metaData": {
          "type": "string"
        },
        "to": {
          "$ref": "#/definitions/Unit"
        },
        "value": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "Country": {
      "type": "string",
      "enum": [
        "unknown",
        "afg",
        "ala",
        "alb",
        "dza",
        "asm",
        "and",
        "ago",
        "aia",
        "ata",
        "atg",
        "arg",
        "arm",
        "abw",
        "aus",
        "aut",
        "aze",
        "bhs",
        "bhr",
        "bgd",
        "brb",
        "blr",
        "bel",
        "blz",
        "ben",
        "bmu",
        "btn",
        "bol",
        "bes",
        "bih",
        "bwa",
        "bvt",
        "bra",
        "iot",
        "brn",
        "bgr",
        "bfa",
        "bdi",
        "cpv",
        "khm",
        "cmr",
        "can",
        "cym",
        "caf",
        "tcd",
        "chl",
        "chn",
        "cxr",
        "cck",
        "col",
        "com",
        "cog",
        "cod",
        "cok",
        "cri",
        "civ",
        "hrv",
        "cub",
        "cuw",
        "cyp",
        "cze",
        "dnk",
        "dji",
        "dma",
        "dom",
        "ecu",
        "egy",
        "slv",
        "gnq",
        "eri",
        "est",
        "swz",
        "eth",
        "flk",
        "fro",
        "fji",
        "fin",
        "fra",
        "guf",
        "pyf",
        "atf",
        "gab",
        "gmb",
        "geo",
        "deu",
        "gha",
        "gib",
        "grc",
        "grl",
        "grd",
        "glp",
        "gum",
        "gtm",
        "ggy",
        "gin",
        "gnb",
        "guy",
        "hti",
        "hmd",
        "vat",
        "hnd",
        "hkg",
        "hun",
        "isl",
        "ind",
        "idn",
        "irn",
        "irq",
        "irl",
        "imn",
        "isr",
        "ita",
        "jam",
        "jpn",
        "jey",
        "jor",
        "kaz",
        "ken",
        "kir",
        "prk",
        "kor",
        "kwt",
        "kgz",
        "lao",
        "lva",
        "lbn",
        "lso",
        "lbr",
        "lby",
        "lie",
        "ltu",
        "lux",
        "mac",
        "mdg",
        "mwi",
        "mys",
        "mdv",
        "mli",
        "mlt",
        "mhl",
        "mtq",
        "mrt",
        "mus",
        "myt",
        "mex",
        "fsm",
        "mda",
        "mco",
        "mng",
        "mne",
        "msr",
        "mar",
        "moz",
        "mmr",
        "nam",
        "nru",
        "npl",
        "nld",
        "ncl",
        "nzl",
        "nic",
        "ner",
        "nga",
        "niu",
        "nfk",
        "mkd",
        "mnp",
        "nor",
        "omn",
        "pak",
        "plw",
        "pse",
        "pan",
        "png",
        "pry",
        "per",
        "phl",
        "pcn",
        "pol",
        "prt",
        "pri",
        "qat",
        "reu",
        "rou",
        "rus",
        "rwa",
        "blm",
        "shn",
        "kna",
        "lca",
        "maf",
        "spm",
        "vct",
        "wsm",
        "smr",
        "stp",
        "sau",
        "sen",
        "srb",
        "syc",
        "sle",
        "sgp",
        "sxm",
        "svk",
        "svn",
        "slb",
        "som",
        "zaf",
        "sgs",
        "ssd",
        "esp",
        "lka",
        "sdn",
        "sur",
        "sjm",
        "swe",
        "che",
        "syr",
        "twn",
        "tjk",
        "tza",
        "tha",
        "tls",
        "tgo",
        "tkl",
        "ton",
        "tto",
        "tun",
        "tur",
        "tkm",
        "tca",
        "tuv",
        "uga",
        "ukr",
        "are",
        "gbr",
        "usa",
        "umi",
        "ury",
        "uzb",
        "vut",
        "ven",
        "vnm",
        "vgb",
        "vir",
        "wlf",
        "esh",
        "yem",
        "zmb",
        "zwe"
      ]
    },
    "EPD": {
      "type": "object",
      "required": [
        "declaredUnit",
        "formatVersion",
        "id",
        "impacts",
        "location",
        "name",
        "publishedDate",
        "standard",
        "subtype",
        "validUntil",
        "version"
      ],
      "properties": {
        "comment": {
          "type": [
            "string",
            "null"
          ]
        },
        "conversions": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Conversion"
          }
        },
        "declaredUnit": {
          "$ref": "#/definitions/Unit"
        },
        "formatVersion": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "impacts": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "number",
                "null"
              ],
              "format": "double"
            }
          }
        },
        "location": {
          "$ref": "#/definitions/Country"
        },
        "metaData": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "publishedDate": {
          "type": "string",
          "format": "date"
        },
        "referenceServiceLife": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint32",
          "minimum": 0.0
        },
        "source": {
          "anyOf": [
            {
              "$ref": "#/definitions/Source"
            },
            {
              "type": "null"
            }
          ]
        },
        "standard": {
          "$ref": "#/definitions/Standard"
        },
        "subtype": {
          "$ref": "#/definitions/SubType"
        },
        "validUntil": {
          "type": "string",
          "format": "date"
        },
        "version": {
          "type": "string"
        }
      }
    },
    "ExternalImpactData": {
      "type": "object",
      "required": [
        "format",
        "url"
      ],
      "properties": {
        "format": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "version": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "GeneralEnergyClass": {
      "type": "string",
      "enum": [
        "existing",
        "standard",
        "advanced",
        "unknown"
      ]
    },
    "ImpactCategoryKey": {
      "type": "string",
      "enum": [
        "gwp",
        "gwp_fos",
        "gwp_bio",
        "gwp_lul",
        "odp",
        "ap",
        "ep",
        "ep_fw",
        "ep_mar",
        "ep_ter",
        "pocp",
        "adpe",
        "adpf",
        "penre",
        "pere",
        "perm",
        "pert",
        "penrt",
        "penrm",
        "sm",
        "pm",
        "wdp",
        "irp",
        "etp_fw",
        "htp_c",
        "htp_nc",
        "sqp",
        "rsf",
        "nrsf",
        "fw",
        "hwd",
        "nhwd",
        "rwd",
        "cru",
        "mrf",
        "mer",
        "eee",
        "eet"
      ]
    },
    "ImpactDataSource": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "EPD"
          ],
          "properties": {
            "EPD": {
              "$ref": "#/definitions/EPD"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "techFlow"
          ],
          "properties": {
            "techFlow": {
              "$ref": "#/definitions/TechFlow"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "externalImpactData"
          ],
          "properties": {
            "externalImpactData": {
              "$ref": "#/definitions/ExternalImpactData"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "internalImpactData"
          ],
          "properties": {
            "internalImpactData": {
              "$ref": "#/definitions/InternalImpactData"
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "InternalImpactData": {
      "type": "object",
      "required": [
        "path"
      ],
      "properties": {
        "path": {
          "type": "string"
        }
      }
    },
    "LifeCycleStage": {
      "type": "string",
      "enum": [
        "a1a3",
        "a4",
        "a5",
        "b1",
        "b2",
        "b3",
        "b4",
        "b5",
        "b6",
        "b7",
        "c1",
        "c2",
        "c3",
        "c4",
        "d"
      ]
    },
    "Location": {
      "type": "object",
      "required": [
        "country"
      ],
      "properties": {
        "address": {
          "type": [
            "string",
            "null"
          ]
        },
        "city": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "$ref": "#/definitions/Country"
        }
      }
    },
    "Product": {
      "type": "object",
      "required": [
        "id",
        "impactData",
        "name",
        "quantity",
        "referenceServiceLife",
        "unit"
      ],
      "properties": {
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "type": "string"
        },
        "impactData": {
          "$ref": "#/definitions/ImpactDataSource"
        },
        "metaData": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "quantity": {
          "type": "number",
          "format": "double"
        },
        "referenceServiceLife": {
          "type": "integer",
          "format": "uint32",
          "minimum": 0.0
        },
        "results": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "number",
                "null"
              ],
              "format": "double"
            }
          }
        },
        "transport": {
          "anyOf": [
            {
              "$ref": "#/definitions/Transport"
            },
            {
              "type": "null"
            }
          ]
        },
        "unit": {
          "$ref": "#/definitions/Unit"
        }
      }
    },
    "ProjectInfo": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "buildingInfo"
          ],
          "properties": {
            "buildingInfo": {
              "$ref": "#/definitions/BuildingInfo"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "infrastructureInfo"
          ],
          "properties": {
            "infrastructureInfo": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "ProjectPhase": {
      "type": "string",
      "enum": [
        "design",
        "ongoing",
        "built",
        "other"
      ]
    },
    "RoofType": {
      "type": "string",
      "enum": [
        "flat",
        "pitched",
        "saddle",
        "pyramid",
        "other"
      ]
    },
    "SoftwareInfo": {
      "type": "object",
      "required": [
        "lcaSoftware"
      ],
      "properties": {
        "calculationType": {
          "type": [
            "string",
            "null"
          ]
        },
        "goalAndScopeDefinition": {
          "type": [
            "string",
            "null"
          ]
        },
        "lcaSoftware": {
          "type": "string"
        }
      }
    },
    "Source": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "url": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "Standard": {
      "type": "string",
      "enum": [
        "en15804a1",
        "en15804a2",
        "unknown"
      ]
    },
    "SubType": {
      "type": "string",
      "enum": [
        "generic",
        "specific",
        "industry",
        "representative"
      ]
    },
    "TechFlow": {
      "type": "object",
      "required": [
        "declaredUnit",
        "formatVersion",
        "id",
        "impacts",
        "location",
        "name"
      ],
      "properties": {
        "comment": {
          "type": [
            "string",
            "null"
          ]
        },
        "conversions": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Conversion"
          }
        },
        "declaredUnit": {
          "$ref": "#/definitions/Unit"
        },
        "formatVersion": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "impacts": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "number",
                "null"
              ],
              "format": "double"
            }
          }
        },
        "location": {
          "$ref": "#/definitions/Country"
        },
        "metaData": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "source": {
          "anyOf": [
            {
              "$ref": "#/definitions/Source"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Transport": {
      "type": "object",
      "required": [
        "distance",
        "distanceUnit",
        "id",
        "name",
        "transportEpd"
      ],
      "properties": {
        "distance": {
          "type": "number",
          "format": "double"
        },
        "distanceUnit": {
          "$ref": "#/definitions/Unit"
        },
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "transportEpd": {
          "$ref": "#/definitions/ImpactDataSource"
        }
      }
    },
    "Unit": {
      "type": "string",
      "enum": [
        "m",
        "m2",
        "m3",
        "kg",
        "tones",
        "pcs",
        "l",
        "m2r1",
        "km",
        "tones_km",
        "unknown"
      ]
    },
    "ValueUnit": {
      "type": "object",
      "required": [
        "unit",
        "value"
      ],
      "properties": {
        "unit": {
          "$ref": "#/definitions/Unit"
        },
        "value": {
          "type": "number",
          "format": "double"
        }
      }
    }
  }
}
use std::collections::HashMap;

use lcax_core::country::Country;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[cfg(feature = "jsbindings")]
use tsify::Tsify;

use crate::assembly::Assembly;
use crate::life_cycle_base::{ImpactCategoryKey, LifeCycleStage, Results};
use crate::shared::Unit;

#[derive(Deserialize, Serialize, JsonSchema, Default, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "jsbindings",
    derive(Tsify),
    tsify(into_wasm_abi, from_wasm_abi)
)]
pub struct Project {
    pub id: String,
    pub name: String,
    pub description: Option<String>,
    pub comment: Option<String>,
    pub location: Location,
    pub owner: Option<String>,
    pub format_version: String,
    pub lcia_method: Option<String>,
    pub classification_system: Option<String>,
    pub reference_study_period: Option<u8>,
    pub life_cycle_stages: Vec<LifeCycleStage>,
    pub impact_categories: Vec<ImpactCategoryKey>,
    pub assemblies: HashMap<String, Assembly>,
    pub results: Results,
    pub project_info: Option<ProjectInfo>,
    pub project_phase: ProjectPhase,
    pub software_info: SoftwareInfo,
    pub meta_data: Option<HashMap<String, String>>,
}

impl Project {
    pub fn new() -> Self {
        Project {
            id: uuid::Uuid::new_v4().to_string(),
            name: "".to_string(),
            description: None,
            comment: None,
            location: Location {
                country: Country::UNKNOWN,
                city: None,
                address: None,
            },
            owner: None,
            format_version: "0.1.0".to_string(),
            lcia_method: None,
            classification_system: None,
            reference_study_period: None,
            life_cycle_stages: vec![],
            impact_categories: vec![],
            assemblies: HashMap::new(),
            results: Results::default(),
            project_info: None,
            project_phase: ProjectPhase::DESIGN,
            software_info: SoftwareInfo {
                goal_and_scope_definition: None,
                lca_software: "lcax".to_string(),
                calculation_type: None,
            },
            meta_data: None,
        }
    }
}

#[derive(Deserialize, Serialize, JsonSchema, Default, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub struct SoftwareInfo {
    pub goal_and_scope_definition: Option<String>,
    pub lca_software: String,
    pub calculation_type: Option<String>,
}

#[derive(Deserialize, Serialize, JsonSchema, Default, Clone)]
#[serde(rename_all = "lowercase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub enum ProjectPhase {
    DESIGN,
    ONGOING,
    BUILT,
    #[default]
    OTHER,
}

#[derive(Deserialize, Serialize, JsonSchema, Default, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub struct Location {
    pub country: Country,
    pub city: Option<String>,
    pub address: Option<String>,
}

#[derive(Deserialize, Serialize, JsonSchema, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub enum ProjectInfo {
    BuildingInfo(BuildingInfo),
    InfrastructureInfo(HashMap<String, String>),
}

#[derive(Deserialize, Serialize, JsonSchema, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub struct BuildingInfo {
    pub building_type: BuildingType,
    pub building_typology: BuildingTypology,
    pub certifications: Option<Vec<String>>,
    pub building_mass: Option<ValueUnit>,
    pub building_height: Option<ValueUnit>,
    pub gross_floor_area: Option<AreaType>,
    pub heated_floor_area: Option<AreaType>,
    pub building_footprint: Option<ValueUnit>,
    pub floors_above_ground: u16,
    pub floors_below_ground: Option<u16>,
    pub roof_type: RoofType,
    pub frame_type: Option<String>,
    pub building_completion_year: Option<u64>,
    pub building_permit_year: Option<u64>,
    pub energy_demand_heating: Option<f64>,
    pub energy_supply_heating: Option<f64>,
    pub energy_demand_electricity: Option<f64>,
    pub energy_supply_electricity: Option<f64>,
    pub exported_electricity: Option<f64>,
    pub general_energy_class: GeneralEnergyClass,
    pub local_energy_class: Option<String>,
    pub building_users: Option<u64>,
    pub building_model_scope: Option<BuildingModelScope>,
}

#[derive(Deserialize, Serialize, JsonSchema, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub struct AreaType {
    pub value: f64,
    pub unit: Unit,
    pub definition: String,
}

#[derive(Deserialize, Serialize, JsonSchema, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub struct ValueUnit {
    value: f64,
    unit: Unit,
}

#[derive(Deserialize, Serialize, JsonSchema, Clone)]
#[serde(rename_all = "lowercase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub enum RoofType {
    FLAT,
    PITCHED,
    SADDLE,
    PYRAMID,
    OTHER,
}

#[derive(Deserialize, Serialize, JsonSchema, Clone)]
#[serde(rename_all = "lowercase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub enum GeneralEnergyClass {
    EXISTING,
    STANDARD,
    ADVANCED,
    UNKNOWN,
}

impl From<&String> for GeneralEnergyClass {
    fn from(class: &String) -> Self {
        match class.to_ascii_lowercase().as_str() {
            "lowenergy" => GeneralEnergyClass::ADVANCED,
            _ => GeneralEnergyClass::UNKNOWN,
        }
    }
}

#[derive(Deserialize, Serialize, JsonSchema, Clone)]
#[serde(rename_all = "lowercase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub struct BuildingModelScope {
    pub facilitating_works: bool,
    pub substructure: bool,
    pub superstructure_frame: bool,
    pub superstructure_envelope: bool,
    pub superstructure_internal_elements: bool,
    pub finishes: bool,
    pub building_services: bool,
    pub external_works: bool,
    pub ff_e: bool,
}

#[derive(Deserialize, Serialize, JsonSchema, Clone)]
#[serde(rename_all = "lowercase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub enum BuildingType {
    RENOVATION,
    NEW,
}

#[derive(Deserialize, Serialize, JsonSchema, Clone)]
#[serde(rename_all = "lowercase")]
#[cfg_attr(feature = "jsbindings", derive(Tsify))]
pub enum BuildingTypology {
    OFFICE,
    RESIDENTIAL,
    PUBLIC,
    COMMERCIAL,
    INDUSTRIAL,
    INFRASTRUCTURE,
    AGRICULTURAL,
    MIXEDUSE,
    OTHER,
}

impl From<&String> for BuildingTypology {
    fn from(unit: &String) -> Self {
        match unit.to_ascii_lowercase().as_str() {
            "office" => BuildingTypology::OFFICE,
            "residential" => BuildingTypology::RESIDENTIAL,
            "public" => BuildingTypology::PUBLIC,
            "commercial" => BuildingTypology::COMMERCIAL,
            "industrial" => BuildingTypology::INDUSTRIAL,
            "infrastructure" => BuildingTypology::INFRASTRUCTURE,
            "agricultural" => BuildingTypology::AGRICULTURAL,
            "mixeduse" => BuildingTypology::MIXEDUSE,
            _ => BuildingTypology::OTHER,
        }
    }
}
/* tslint:disable */
/* eslint-disable */
/**
* @param {string} data
* @param {string | undefined} [resultData]
* @returns {Project}
*/
export function convertLCAbyg(data: string, resultData?: string): Project;
/**
* @param {string} data
* @returns {EPD}
*/
export function convertIlcd(data: string): EPD;
/**
* @param {Uint8Array} file
* @returns {JSProjects}
*/
export function convertSLiCE(file: Uint8Array): JSProjects;
export type JSProjects = Project[];

export type BuildingTypology = "office" | "residential" | "public" | "commercial" | "industrial" | "infrastructure" | "agricultural" | "mixeduse" | "other";

export type BuildingType = "renovation" | "new";

export interface BuildingModelScope {
    facilitating_works: boolean;
    substructure: boolean;
    superstructure_frame: boolean;
    superstructure_envelope: boolean;
    superstructure_internal_elements: boolean;
    finishes: boolean;
    building_services: boolean;
    external_works: boolean;
    ff_e: boolean;
}

export type GeneralEnergyClass = "existing" | "standard" | "advanced" | "unknown";

export type RoofType = "flat" | "pitched" | "saddle" | "pyramid" | "other";

export interface ValueUnit {
    value: number;
    unit: Unit;
}

export interface AreaType {
    value: number;
    unit: Unit;
    definition: string;
}

export interface BuildingInfo {
    buildingType: BuildingType;
    buildingTypology: BuildingTypology;
    certifications: string[] | null;
    buildingMass: ValueUnit | null;
    buildingHeight: ValueUnit | null;
    grossFloorArea: AreaType | null;
    heatedFloorArea: AreaType | null;
    buildingFootprint: ValueUnit | null;
    floorsAboveGround: number;
    floorsBelowGround: number | null;
    roofType: RoofType;
    frameType: string | null;
    buildingCompletionYear: number | null;
    buildingPermitYear: number | null;
    energyDemandHeating: number | null;
    energySupplyHeating: number | null;
    energyDemandElectricity: number | null;
    energySupplyElectricity: number | null;
    exportedElectricity: number | null;
    generalEnergyClass: GeneralEnergyClass;
    localEnergyClass: string | null;
    buildingUsers: number | null;
    buildingModelScope: BuildingModelScope | null;
}

export type ProjectInfo = { buildingInfo: BuildingInfo } | { infrastructureInfo: Record<string, string> };

export interface Location {
    country: Country;
    city: string | null;
    address: string | null;
}

export type ProjectPhase = "design" | "ongoing" | "built" | "other";

export interface SoftwareInfo {
    goalAndScopeDefinition: string | null;
    lcaSoftware: string;
    calculationType: string | null;
}

export interface Project {
    id: string;
    name: string;
    description: string | null;
    comment: string | null;
    location: Location;
    owner: string | null;
    formatVersion: string;
    lciaMethod: string | null;
    classificationSystem: string | null;
    referenceStudyPeriod: number | null;
    lifeCycleStages: LifeCycleStage[];
    impactCategories: ImpactCategoryKey[];
    assemblies: Record<string, Assembly>;
    results: Results;
    projectInfo: ProjectInfo | null;
    projectPhase: ProjectPhase;
    softwareInfo: SoftwareInfo;
    metaData: Record<string, string> | null;
}

export type SubType = "generic" | "specific" | "industry" | "representative";

export type Standard = "en15804a1" | "en15804a2" | "unknown";

export interface EPD {
    id: string;
    name: string;
    declaredUnit: Unit;
    version: string;
    publishedDate: NaiveDate;
    validUntil: NaiveDate;
    formatVersion: string;
    source: Source | null;
    referenceServiceLife: number | null;
    standard: Standard;
    comment: string | null;
    location: Country;
    subtype: SubType;
    conversions: Conversion[] | null;
    impacts: Record<ImpactCategoryKey, ImpactCategory>;
    metaData: Record<string, string> | null;
}

export type ImpactCategoryKey = "gwp" | "gwp_fos" | "gwp_bio" | "gwp_lul" | "odp" | "ap" | "ep" | "ep_fw" | "ep_mar" | "ep_ter" | "pocp" | "adpe" | "adpf" | "penre" | "pere" | "perm" | "pert" | "penrt" | "penrm" | "sm" | "pm" | "wdp" | "irp" | "etp_fw" | "htp_c" | "htp_nc" | "sqp" | "rsf" | "nrsf" | "fw" | "hwd" | "nhwd" | "rwd" | "cru" | "mrf" | "mer" | "eee" | "eet";

export type LifeCycleStage = "a1a3" | "a4" | "a5" | "b1" | "b2" | "b3" | "b4" | "b5" | "b6" | "b7" | "c1" | "c2" | "c3" | "c4" | "d";

export interface Source {
    name: string;
    url: string | null;
}

export interface Conversion {
    value: number;
    to: Unit;
    metaData: string;
}

export type Unit = "m" | "m2" | "m3" | "kg" | "tones" | "pcs" | "l" | "m2r1" | "km" | "tones_km" | "unknown";

export interface TechFlow {
    id: string;
    name: string;
    declaredUnit: Unit;
    formatVersion: string;
    source: Source | null;
    comment: string | null;
    location: Country;
    conversions: Conversion[] | null;
    impacts: Record<ImpactCategoryKey, ImpactCategory>;
    metaData: Record<string, string> | null;
}

export interface Classification {
    system: string;
    code: string;
    name: string;
}

export interface Assembly {
    id: string;
    name: string;
    description: string | null;
    comment: string | null;
    quantity: number;
    unit: Unit;
    category: string | null;
    classification: Classification[] | null;
    products: Record<string, Product>;
    results: Results;
    metaData: Record<string, string> | null;
}

export interface InternalImpactData {
    path: string;
}

export interface ExternalImpactData {
    url: string;
    format: string;
    version: string | null;
}

export type ImpactDataSource = { EPD: EPD } | { techFlow: TechFlow } | { externalImpactData: ExternalImpactData } | { internalImpactData: InternalImpactData };

export interface Transport {
    id: string;
    name: string;
    distance: number;
    distanceUnit: Unit;
    transportEpd: ImpactDataSource;
}

export interface Product {
    id: string;
    name: string;
    description: string | null;
    referenceServiceLife: number;
    impactData: ImpactDataSource;
    quantity: number;
    unit: Unit;
    transport: Transport | null;
    results: Results;
    metaData: Record<string, string> | null;
}
namespace LCAx
{

    public partial class Lcax
    {
        public Dictionary<string, Assembly> Assemblies { get; set; }
        public string ClassificationSystem { get; set; }
        public string Comment { get; set; }
        public string Description { get; set; }
        public string FormatVersion { get; set; }
        public string Id { get; set; }
        public ImpactCategoryKey[] ImpactCategories { get; set; }
        public string LciaMethod { get; set; }
        public LifeCycleStage[] LifeCycleStages { get; set; }
        public Location Location { get; set; }
        public Dictionary<string, string> MetaData { get; set; }
        public string Name { get; set; }
        public string Owner { get; set; }
        public ProjectInfo ProjectInfo { get; set; }
        public ProjectPhase ProjectPhase { get; set; }
        public long? ReferenceStudyPeriod { get; set; }
        public Dictionary<string, Dictionary<string, double?>> Results { get; set; }
        public SoftwareInfo SoftwareInfo { get; set; }
    }

    public partial class Assembly
    {
        public string Category { get; set; }
        public Classification[] Classification { get; set; }
        public string Comment { get; set; }
        public string Description { get; set; }
        public string Id { get; set; }
        public Dictionary<string, string> MetaData { get; set; }
        public string Name { get; set; }
        public Dictionary<string, Product> Products { get; set; }
        public double Quantity { get; set; }
        public Dictionary<string, Dictionary<string, double?>> Results { get; set; }
        public Unit Unit { get; set; }
    }

    public partial class Classification
    {
        public string Code { get; set; }
        public string Name { get; set; }
        public string System { get; set; }
    }

    public partial class Product
    {
        public string Description { get; set; }
        public string Id { get; set; }
        public ImpactDataSource ImpactData { get; set; }
        public Dictionary<string, string> MetaData { get; set; }
        public string Name { get; set; }
        public double Quantity { get; set; }
        public long ReferenceServiceLife { get; set; }
        public Dictionary<string, Dictionary<string, double?>> Results { get; set; }
        public Transport Transport { get; set; }
        public Unit Unit { get; set; }
    }

    public partial class ImpactDataSource
    {
        public Epd Epd { get; set; }
        public TechFlow TechFlow { get; set; }
        public ExternalImpactData ExternalImpactData { get; set; }
        public InternalImpactData InternalImpactData { get; set; }
    }

    public partial class Epd
    {
        public string Comment { get; set; }
        public Conversion[] Conversions { get; set; }
        public Unit DeclaredUnit { get; set; }
        public string FormatVersion { get; set; }
        public string Id { get; set; }
        public Dictionary<string, Dictionary<string, double?>> Impacts { get; set; }
        public Country Location { get; set; }
        public Dictionary<string, string> MetaData { get; set; }
        public string Name { get; set; }
        public DateTimeOffset PublishedDate { get; set; }
        public long? ReferenceServiceLife { get; set; }
        public Source Source { get; set; }
        public Standard Standard { get; set; }
        public SubType Subtype { get; set; }
        public DateTimeOffset ValidUntil { get; set; }
        public string Version { get; set; }
    }

    public partial class Conversion
    {
        public string MetaData { get; set; }
        public Unit To { get; set; }
        public double Value { get; set; }
    }

    public partial class Source
    {
        public string Name { get; set; }
        public string Url { get; set; }
    }

    public partial class ExternalImpactData
    {
        public string Format { get; set; }
        public string Url { get; set; }
        public string Version { get; set; }
    }

    public partial class InternalImpactData
    {
        public string Path { get; set; }
    }

    public partial class TechFlow
    {
        public string Comment { get; set; }
        public Conversion[] Conversions { get; set; }
        public Unit DeclaredUnit { get; set; }
        public string FormatVersion { get; set; }
        public string Id { get; set; }
        public Dictionary<string, Dictionary<string, double?>> Impacts { get; set; }
        public Country Location { get; set; }
        public Dictionary<string, string> MetaData { get; set; }
        public string Name { get; set; }
        public Source Source { get; set; }
    }

    public partial class Transport
    {
        public double Distance { get; set; }
        public Unit DistanceUnit { get; set; }
        public string Id { get; set; }
        public string Name { get; set; }
        public ImpactDataSource TransportEpd { get; set; }
    }

    public partial class Location
    {
        public string Address { get; set; }
        public string City { get; set; }
        public Country Country { get; set; }
    }

    public partial class ProjectInfo
    {
        public BuildingInfo BuildingInfo { get; set; }
        public Dictionary<string, string> InfrastructureInfo { get; set; }
    }

    public partial class BuildingInfo
    {
        public long? BuildingCompletionYear { get; set; }
        public ValueUnit BuildingFootprint { get; set; }
        public ValueUnit BuildingHeight { get; set; }
        public ValueUnit BuildingMass { get; set; }
        public BuildingModelScope BuildingModelScope { get; set; }
        public long? BuildingPermitYear { get; set; }
        public BuildingType BuildingType { get; set; }
        public BuildingTypology BuildingTypology { get; set; }
        public long? BuildingUsers { get; set; }
        public string[] Certifications { get; set; }
        public double? EnergyDemandElectricity { get; set; }
        public double? EnergyDemandHeating { get; set; }
        public double? EnergySupplyElectricity { get; set; }
        public double? EnergySupplyHeating { get; set; }
        public double? ExportedElectricity { get; set; }
        public long FloorsAboveGround { get; set; }
        public long? FloorsBelowGround { get; set; }
        public string FrameType { get; set; }
        public GeneralEnergyClass GeneralEnergyClass { get; set; }
        public AreaType GrossFloorArea { get; set; }
        public AreaType HeatedFloorArea { get; set; }
        public string LocalEnergyClass { get; set; }
        public RoofType RoofType { get; set; }
    }

    public partial class ValueUnit
    {
        public Unit Unit { get; set; }
        public double Value { get; set; }
    }

    public partial class BuildingModelScope
    {
        public bool BuildingServices { get; set; }
        public bool ExternalWorks { get; set; }
        public bool FacilitatingWorks { get; set; }
        public bool FfE { get; set; }
        public bool Finishes { get; set; }
        public bool Substructure { get; set; }
        public bool SuperstructureEnvelope { get; set; }
        public bool SuperstructureFrame { get; set; }
        public bool SuperstructureInternalElements { get; set; }
    }

    public partial class AreaType
    {
        public string Definition { get; set; }
        public Unit Unit { get; set; }
        public double Value { get; set; }
    }

    public partial class SoftwareInfo
    {
        public string CalculationType { get; set; }
        public string GoalAndScopeDefinition { get; set; }
        public string LcaSoftware { get; set; }
    }

    public enum Unit { Kg, Km, L, M, M2, M2R1, M3, Pcs, Tones, TonesKm, Unknown };

    public enum Country { Abw, Afg, Ago, Aia, Ala, Alb, And, Are, Arg, Arm, Asm, Ata, Atf, Atg, Aus, Aut, Aze, Bdi, Bel, Ben, Bes, Bfa, Bgd, Bgr, Bhr, Bhs, Bih, Blm, Blr, Blz, Bmu, Bol, Bra, Brb, Brn, Btn, Bvt, Bwa, Caf, Can, Cck, Che, Chl, Chn, Civ, Cmr, Cod, Cog, Cok, Col, Com, Cpv, Cri, Cub, Cuw, Cxr, Cym, Cyp, Cze, Deu, Dji, Dma, Dnk, Dom, Dza, Ecu, Egy, Eri, Esh, Esp, Est, Eth, Fin, Fji, Flk, Fra, Fro, Fsm, Gab, Gbr, Geo, Ggy, Gha, Gib, Gin, Glp, Gmb, Gnb, Gnq, Grc, Grd, Grl, Gtm, Guf, Gum, Guy, Hkg, Hmd, Hnd, Hrv, Hti, Hun, Idn, Imn, Ind, Iot, Irl, Irn, Irq, Isl, Isr, Ita, Jam, Jey, Jor, Jpn, Kaz, Ken, Kgz, Khm, Kir, Kna, Kor, Kwt, Lao, Lbn, Lbr, Lby, Lca, Lie, Lka, Lso, Ltu, Lux, Lva, Mac, Maf, Mar, Mco, Mda, Mdg, Mdv, Mex, Mhl, Mkd, Mli, Mlt, Mmr, Mne, Mng, Mnp, Moz, Mrt, Msr, Mtq, Mus, Mwi, Mys, Myt, Nam, Ncl, Ner, Nfk, Nga, Nic, Niu, Nld, Nor, Npl, Nru, Nzl, Omn, Pak, Pan, Pcn, Per, Phl, Plw, Png, Pol, Pri, Prk, Prt, Pry, Pse, Pyf, Qat, Reu, Rou, Rus, Rwa, Sau, Sdn, Sen, Sgp, Sgs, Shn, Sjm, Slb, Sle, Slv, Smr, Som, Spm, Srb, Ssd, Stp, Sur, Svk, Svn, Swe, Swz, Sxm, Syc, Syr, Tca, Tcd, Tgo, Tha, Tjk, Tkl, Tkm, Tls, Ton, Tto, Tun, Tur, Tuv, Twn, Tza, Uga, Ukr, Umi, Unknown, Ury, Usa, Uzb, Vat, Vct, Ven, Vgb, Vir, Vnm, Vut, Wlf, Wsm, Yem, Zaf, Zmb, Zwe };

    public enum Standard { En15804A1, En15804A2, Unknown };

    public enum SubType { Generic, Industry, Representative, Specific };

    public enum ImpactCategoryKey { Adpe, Adpf, Ap, Cru, Eee, Eet, Ep, EpFw, EpMar, EpTer, EtpFw, Fw, Gwp, GwpBio, GwpFos, GwpLul, HtpC, HtpNc, Hwd, Irp, Mer, Mrf, Nhwd, Nrsf, Odp, Penre, Penrm, Penrt, Pere, Perm, Pert, Pm, Pocp, Rsf, Rwd, Sm, Sqp, Wdp };

    public enum LifeCycleStage { A1A3, A4, A5, B1, B2, B3, B4, B5, B6, B7, C1, C2, C3, C4, D };

    public enum BuildingType { New, Renovation };

    public enum BuildingTypology { Agricultural, Commercial, Industrial, Infrastructure, Mixeduse, Office, Other, Public, Residential };

    public enum GeneralEnergyClass { Advanced, Existing, Standard, Unknown };

    public enum RoofType { Flat, Other, Pitched, Pyramid, Saddle };

    public enum ProjectPhase { Built, Design, Ongoing, Other };
}

Download