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 datetime
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from pydantic import BaseModel, Extra, Field


class Classification(BaseModel):
    class Config:
        allow_population_by_field_name = True

    code: str
    name: str
    system: str


class DistanceUnit(Enum):
    m = 'm'
    km = 'km'


class ExternalEPD(BaseModel):
    class Config:
        allow_population_by_field_name = True

    format: str
    url: str
    version: Optional[str] = None


class ImpactCategory(BaseModel):
    class Config:
        allow_population_by_field_name = True

    a1a3: Optional[float] = None
    a4: Optional[float] = None
    a5: Optional[float] = None
    b1: Optional[float] = None
    b2: Optional[float] = None
    b3: Optional[float] = None
    b4: Optional[float] = None
    b5: Optional[float] = None
    b6: Optional[float] = None
    b7: Optional[float] = None
    c1: Optional[float] = None
    c2: Optional[float] = None
    c3: Optional[float] = None
    c4: Optional[float] = None
    d: Optional[float] = None


class ImpactCategoryKey(Enum):
    gwp = 'gwp'
    odp = 'odp'
    ap = 'ap'
    ep = 'ep'
    pocp = 'pocp'
    adpe = 'adpe'
    adpf = 'adpf'
    penre = 'penre'
    pere = 'pere'
    perm = 'perm'
    pert = 'pert'
    penrt = 'penrt'
    penrm = 'penrm'
    sm = 'sm'
    rsf = 'rsf'
    nrsf = 'nrsf'
    fw = 'fw'
    hwd = 'hwd'
    nhwd = 'nhwd'
    rwd = 'rwd'
    cru = 'cru'
    mrf = 'mrf'
    mer = 'mer'
    eee = 'eee'
    eet = 'eet'


class InternalEPD(BaseModel):
    class Config:
        allow_population_by_field_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 Source(BaseModel):
    class Config:
        allow_population_by_field_name = True

    name: str
    url: Optional[str] = None


class Standard(Enum):
    en15804_a1 = 'EN15804A1'
    en15804_a2 = 'EN15804A2'
    unknown = 'UNKNOWN'


class SubType(Enum):
    generic = 'Generic'
    specific = 'Specific'
    industry = 'Industry'
    representative = 'Representative'


class TransportType(Enum):
    truck = 'truck'
    train = 'train'
    ship = 'ship'
    plane = 'plane'


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


class Conversion(BaseModel):
    class Config:
        allow_population_by_field_name = True

    to: Unit
    value: float


class EPD(BaseModel):
    class Config:
        allow_population_by_field_name = True

    adpe: Optional[ImpactCategory] = None
    adpf: Optional[ImpactCategory] = None
    ap: Optional[ImpactCategory] = None
    comment: Optional[str] = None
    conversions: Optional[List[Conversion]] = None
    cru: Optional[ImpactCategory] = None
    declared_unit: Unit
    eee: Optional[ImpactCategory] = None
    eet: Optional[ImpactCategory] = None
    ep: Optional[ImpactCategory] = None
    format_version: str
    fw: Optional[ImpactCategory] = None
    gwp: Optional[ImpactCategory] = None
    hwd: Optional[ImpactCategory] = None
    id: str
    location: str
    mer: Optional[ImpactCategory] = None
    meta_data: Optional[Dict[str, Any]] = None
    mrf: Optional[ImpactCategory] = None
    name: str
    nhwd: Optional[ImpactCategory] = None
    nrsf: Optional[ImpactCategory] = None
    odp: Optional[ImpactCategory] = None
    penre: Optional[ImpactCategory] = None
    penrm: Optional[ImpactCategory] = None
    penrt: Optional[ImpactCategory] = None
    pere: Optional[ImpactCategory] = None
    perm: Optional[ImpactCategory] = None
    pert: Optional[ImpactCategory] = None
    pocp: Optional[ImpactCategory] = None
    published_date: datetime
    reference_service_life: Optional[int] = Field(None, ge=0)
    rsf: Optional[ImpactCategory] = None
    rwd: Optional[ImpactCategory] = None
    sm: Optional[ImpactCategory] = None
    source: Optional[Source] = None
    standard: Standard
    subtype: SubType
    valid_until: datetime
    version: str


class EPDSource1(BaseModel):
    class Config:
        extra = Extra.forbid
        allow_population_by_field_name = True

    epd: EPD


class EPDSource2(BaseModel):
    class Config:
        extra = Extra.forbid
        allow_population_by_field_name = True

    externalepd: ExternalEPD


class EPDSource3(BaseModel):
    class Config:
        extra = Extra.forbid
        allow_population_by_field_name = True

    internalepd: InternalEPD


class Transport(BaseModel):
    class Config:
        allow_population_by_field_name = True

    distance: float
    distance_unit: DistanceUnit = Field(..., alias='distanceUnit')
    id: str
    name: str
    transport_type: TransportType = Field(..., alias='transportType')


class EPDPart(BaseModel):
    class Config:
        allow_population_by_field_name = True

    epd_source: Union[EPDSource1, EPDSource2, EPDSource3] = Field(
        ..., alias='epdSource'
    )
    id: str
    meta_data: Optional[Dict[str, Any]] = Field(None, alias='metaData')
    name: str
    part_quantity: float = Field(..., alias='partQuantity')
    part_unit: Unit = Field(..., alias='partUnit')
    reference_service_life: float = Field(..., alias='referenceServiceLife')
    transport: Optional[Transport] = None


class Assembly(BaseModel):
    class Config:
        allow_population_by_field_name = True

    category: Optional[str] = None
    classification: Optional[List[Classification]] = None
    comment: Optional[str] = None
    description: str
    id: str
    meta_data: Optional[Dict[str, Any]] = Field(None, alias='metaData')
    name: str
    parts: Dict[str, EPDPart]
    quantity: float
    results: Optional[Dict[str, Any]] = None
    unit: Unit


class LCAxProject(BaseModel):
    class Config:
        allow_population_by_field_name = True

    classification_system: Optional[str] = Field(None, alias='classificationSystem')
    comment: Optional[str] = None
    description: str
    emission_parts: Dict[str, Assembly] = Field(..., alias='emissionParts')
    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')
    life_span: Optional[int] = Field(None, alias='lifeSpan', ge=0)
    location: str
    meta_data: Optional[Dict[str, Any]] = Field(None, alias='metaData')
    name: str
    results: Optional[Dict[str, Any]] = None
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "LCAxProject",
  "type": "object",
  "required": [
    "description",
    "emissionParts",
    "formatVersion",
    "id",
    "impactCategories",
    "lifeCycleStages",
    "location",
    "name"
  ],
  "properties": {
    "classificationSystem": {
      "type": [
        "string",
        "null"
      ]
    },
    "comment": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": "string"
    },
    "emissionParts": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/Assembly"
      }
    },
    "formatVersion": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "impactCategories": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/ImpactCategoryKey"
      }
    },
    "lciaMethod": {
      "type": [
        "string",
        "null"
      ]
    },
    "lifeCycleStages": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/LifeCycleStage"
      }
    },
    "lifeSpan": {
      "type": [
        "integer",
        "null"
      ],
      "format": "uint8",
      "minimum": 0.0
    },
    "location": {
      "type": "string"
    },
    "metaData": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      }
    },
    "name": {
      "type": "string"
    },
    "results": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "object",
        "additionalProperties": {
          "type": "number",
          "format": "double"
        }
      }
    }
  },
  "definitions": {
    "Assembly": {
      "type": "object",
      "required": [
        "description",
        "id",
        "name",
        "parts",
        "quantity",
        "unit"
      ],
      "properties": {
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "classification": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Classification"
          }
        },
        "comment": {
          "type": [
            "string",
            "null"
          ]
        },
        "description": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metaData": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "parts": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/EPDPart"
          }
        },
        "quantity": {
          "type": "number",
          "format": "double"
        },
        "results": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "object",
            "additionalProperties": {
              "type": "number",
              "format": "double"
            }
          }
        },
        "unit": {
          "$ref": "#/definitions/Unit"
        }
      }
    },
    "Classification": {
      "type": "object",
      "required": [
        "code",
        "name",
        "system"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "system": {
          "type": "string"
        }
      }
    },
    "Conversion": {
      "type": "object",
      "required": [
        "to",
        "value"
      ],
      "properties": {
        "to": {
          "$ref": "#/definitions/Unit"
        },
        "value": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "DistanceUnit": {
      "type": "string",
      "enum": [
        "m",
        "km"
      ]
    },
    "EPD": {
      "type": "object",
      "required": [
        "declared_unit",
        "format_version",
        "id",
        "location",
        "name",
        "published_date",
        "standard",
        "subtype",
        "valid_until",
        "version"
      ],
      "properties": {
        "adpe": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "adpf": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "ap": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "comment": {
          "type": [
            "string",
            "null"
          ]
        },
        "conversions": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Conversion"
          }
        },
        "cru": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "declared_unit": {
          "$ref": "#/definitions/Unit"
        },
        "eee": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "eet": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "ep": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "format_version": {
          "type": "string"
        },
        "fw": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "gwp": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "hwd": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "id": {
          "type": "string"
        },
        "location": {
          "type": "string"
        },
        "mer": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "meta_data": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "mrf": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "name": {
          "type": "string"
        },
        "nhwd": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "nrsf": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "odp": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "penre": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "penrm": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "penrt": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "pere": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "perm": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "pert": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "pocp": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "published_date": {
          "type": "string",
          "format": "date-time"
        },
        "reference_service_life": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint32",
          "minimum": 0.0
        },
        "rsf": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "rwd": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "sm": {
          "anyOf": [
            {
              "$ref": "#/definitions/ImpactCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "source": {
          "anyOf": [
            {
              "$ref": "#/definitions/Source"
            },
            {
              "type": "null"
            }
          ]
        },
        "standard": {
          "$ref": "#/definitions/Standard"
        },
        "subtype": {
          "$ref": "#/definitions/SubType"
        },
        "valid_until": {
          "type": "string",
          "format": "date-time"
        },
        "version": {
          "type": "string"
        }
      }
    },
    "EPDPart": {
      "type": "object",
      "required": [
        "epdSource",
        "id",
        "name",
        "partQuantity",
        "partUnit",
        "referenceServiceLife"
      ],
      "properties": {
        "epdSource": {
          "$ref": "#/definitions/EPDSource"
        },
        "id": {
          "type": "string"
        },
        "metaData": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "partQuantity": {
          "type": "number",
          "format": "double"
        },
        "partUnit": {
          "$ref": "#/definitions/Unit"
        },
        "referenceServiceLife": {
          "type": "number",
          "format": "double"
        },
        "transport": {
          "anyOf": [
            {
              "$ref": "#/definitions/Transport"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "EPDSource": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "epd"
          ],
          "properties": {
            "epd": {
              "$ref": "#/definitions/EPD"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "externalepd"
          ],
          "properties": {
            "externalepd": {
              "$ref": "#/definitions/ExternalEPD"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "internalepd"
          ],
          "properties": {
            "internalepd": {
              "$ref": "#/definitions/InternalEPD"
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "ExternalEPD": {
      "type": "object",
      "required": [
        "format",
        "url"
      ],
      "properties": {
        "format": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "version": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "ImpactCategory": {
      "type": "object",
      "properties": {
        "a1a3": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "a4": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "a5": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "b1": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "b2": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "b3": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "b4": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "b5": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "b6": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "b7": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "c1": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "c2": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "c3": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "c4": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "d": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      }
    },
    "ImpactCategoryKey": {
      "type": "string",
      "enum": [
        "gwp",
        "odp",
        "ap",
        "ep",
        "pocp",
        "adpe",
        "adpf",
        "penre",
        "pere",
        "perm",
        "pert",
        "penrt",
        "penrm",
        "sm",
        "rsf",
        "nrsf",
        "fw",
        "hwd",
        "nhwd",
        "rwd",
        "cru",
        "mrf",
        "mer",
        "eee",
        "eet"
      ]
    },
    "InternalEPD": {
      "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"
      ]
    },
    "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"
      ]
    },
    "Transport": {
      "type": "object",
      "required": [
        "distance",
        "distanceUnit",
        "id",
        "name",
        "transportType"
      ],
      "properties": {
        "distance": {
          "type": "number",
          "format": "double"
        },
        "distanceUnit": {
          "$ref": "#/definitions/DistanceUnit"
        },
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "transportType": {
          "$ref": "#/definitions/TransportType"
        }
      }
    },
    "TransportType": {
      "type": "string",
      "enum": [
        "truck",
        "train",
        "ship",
        "plane"
      ]
    },
    "Unit": {
      "type": "string",
      "enum": [
        "M",
        "M2",
        "M3",
        "KG",
        "TONES",
        "PCS",
        "L",
        "M2R1",
        "UNKNOWN"
      ]
    }
  }
}
use std::collections::HashMap;

use epdx::epd::{EPD, Unit};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct LCAxProject {
    pub id: String,
    pub name: String,
    pub description: String,
    pub comment: Option<String>,
    pub location: String,
    pub format_version: String,
    pub lcia_method: Option<String>,
    pub classification_system: Option<String>,
    pub life_span: Option<u8>,
    pub life_cycle_stages: Vec<LifeCycleStage>,
    pub impact_categories: Vec<ImpactCategoryKey>,
    pub emission_parts: HashMap<String, Assembly>,
    pub results: Option<HashMap<ImpactCategoryKey, HashMap<LifeCycleStage, f64>>>,
    pub meta_data: Option<HashMap<String, String>>,
}

#[derive(Deserialize, Serialize, JsonSchema, Hash, Eq, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum LifeCycleStage {
    A1A3,
    A4,
    A5,
    B1,
    B2,
    B3,
    B4,
    B5,
    B6,
    B7,
    C1,
    C2,
    C3,
    C4,
    D,
}

#[derive(Deserialize, Serialize, JsonSchema, Hash, Eq, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum ImpactCategoryKey {
    GWP,
    ODP,
    AP,
    EP,
    POCP,
    ADPE,
    ADPF,
    PENRE,
    PERE,
    PERM,
    PERT,
    PENRT,
    PENRM,
    SM,
    RSF,
    NRSF,
    FW,
    HWD,
    NHWD,
    RWD,
    CRU,
    MRF,
    MER,
    EEE,
    EET
}

#[derive(Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct Assembly {
    id: String,
    name: String,
    description: String,
    comment: Option<String>,
    quantity: f64,
    unit: Unit,
    category: Option<String>,
    classification: Option<Vec<Classification>>,
    parts: HashMap<String, EPDPart>,
    results: Option<HashMap<ImpactCategoryKey, HashMap<LifeCycleStage, f64>>>,
    meta_data: Option<HashMap<String, String>>,
}

#[derive(Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct EPDPart {
    id: String,
    name: String,
    reference_service_life: f64,
    epd_source: EPDSource,
    part_quantity: f64,
    part_unit: Unit,
    transport: Option<Transport>,
    meta_data: Option<HashMap<String, String>>,
}

#[derive(Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct Transport {
    id: String,
    name: String,
    distance: f64,
    distance_unit: DistanceUnit,
    transport_type: TransportType,
}

#[derive(Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum EPDSource {
    EPD(EPD),
    ExternalEPD(ExternalEPD),
    InternalEPD(InternalEPD),
}

#[derive(Deserialize, Serialize, JsonSchema)]
pub struct ExternalEPD {
    url: String,
    format: String,
    version: Option<String>,
}

#[derive(Deserialize, Serialize, JsonSchema)]
pub struct InternalEPD {
    path: String,
}


#[derive(Deserialize, Serialize, JsonSchema)]
pub struct Classification {
    system: String,
    code: String,
    name: String,
}

#[derive(Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum DistanceUnit {
    M,
    KM
}

#[derive(Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum TransportType {
    TRUCK,
    TRAIN,
    SHIP,
    PLANE,
}
/* eslint-disable */
/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */

export type EPDSource =
  | {
      epd: EPD;
    }
  | {
      externalepd: ExternalEPD;
    }
  | {
      internalepd: InternalEPD;
    };
export type Unit = "M" | "M2" | "M3" | "KG" | "TONES" | "PCS" | "L" | "M2R1" | "UNKNOWN";
export type Standard = "EN15804A1" | "EN15804A2" | "UNKNOWN";
export type SubType = "Generic" | "Specific" | "Industry" | "Representative";
export type DistanceUnit = "m" | "km";
export type TransportType = "truck" | "train" | "ship" | "plane";
export type ImpactCategoryKey =
  | "gwp"
  | "odp"
  | "ap"
  | "ep"
  | "pocp"
  | "adpe"
  | "adpf"
  | "penre"
  | "pere"
  | "perm"
  | "pert"
  | "penrt"
  | "penrm"
  | "sm"
  | "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 LCAxProject {
  classificationSystem?: string | null;
  comment?: string | null;
  description: string;
  emissionParts: {
    [k: string]: Assembly;
  };
  formatVersion: string;
  id: string;
  impactCategories: ImpactCategoryKey[];
  lciaMethod?: string | null;
  lifeCycleStages: LifeCycleStage[];
  lifeSpan?: number | null;
  location: string;
  metaData?: {
    [k: string]: string;
  } | null;
  name: string;
  results?: {
    [k: string]: {
      [k: string]: number;
    };
  } | null;
  [k: string]: unknown;
}
export interface Assembly {
  category?: string | null;
  classification?: Classification[] | null;
  comment?: string | null;
  description: string;
  id: string;
  metaData?: {
    [k: string]: string;
  } | null;
  name: string;
  parts: {
    [k: string]: EPDPart;
  };
  quantity: number;
  results?: {
    [k: string]: {
      [k: string]: number;
    };
  } | null;
  unit: Unit;
  [k: string]: unknown;
}
export interface Classification {
  code: string;
  name: string;
  system: string;
  [k: string]: unknown;
}
export interface EPDPart {
  epdSource: EPDSource;
  id: string;
  metaData?: {
    [k: string]: string;
  } | null;
  name: string;
  partQuantity: number;
  partUnit: Unit;
  referenceServiceLife: number;
  transport?: Transport | null;
  [k: string]: unknown;
}
export interface EPD {
  adpe?: ImpactCategory | null;
  adpf?: ImpactCategory | null;
  ap?: ImpactCategory | null;
  comment?: string | null;
  conversions?: Conversion[] | null;
  cru?: ImpactCategory | null;
  declared_unit: Unit;
  eee?: ImpactCategory | null;
  eet?: ImpactCategory | null;
  ep?: ImpactCategory | null;
  format_version: string;
  fw?: ImpactCategory | null;
  gwp?: ImpactCategory | null;
  hwd?: ImpactCategory | null;
  id: string;
  location: string;
  mer?: ImpactCategory | null;
  meta_data?: {
    [k: string]: string;
  } | null;
  mrf?: ImpactCategory | null;
  name: string;
  nhwd?: ImpactCategory | null;
  nrsf?: ImpactCategory | null;
  odp?: ImpactCategory | null;
  penre?: ImpactCategory | null;
  penrm?: ImpactCategory | null;
  penrt?: ImpactCategory | null;
  pere?: ImpactCategory | null;
  perm?: ImpactCategory | null;
  pert?: ImpactCategory | null;
  pocp?: ImpactCategory | null;
  published_date: string;
  reference_service_life?: number | null;
  rsf?: ImpactCategory | null;
  rwd?: ImpactCategory | null;
  sm?: ImpactCategory | null;
  source?: Source | null;
  standard: Standard;
  subtype: SubType;
  valid_until: string;
  version: string;
  [k: string]: unknown;
}
export interface ImpactCategory {
  a1a3?: number | null;
  a4?: number | null;
  a5?: number | null;
  b1?: number | null;
  b2?: number | null;
  b3?: number | null;
  b4?: number | null;
  b5?: number | null;
  b6?: number | null;
  b7?: number | null;
  c1?: number | null;
  c2?: number | null;
  c3?: number | null;
  c4?: number | null;
  d?: number | null;
  [k: string]: unknown;
}
export interface Conversion {
  to: Unit;
  value: number;
  [k: string]: unknown;
}
export interface Source {
  name: string;
  url?: string | null;
  [k: string]: unknown;
}
export interface ExternalEPD {
  format: string;
  url: string;
  version?: string | null;
  [k: string]: unknown;
}
export interface InternalEPD {
  path: string;
  [k: string]: unknown;
}
export interface Transport {
  distance: number;
  distanceUnit: DistanceUnit;
  id: string;
  name: string;
  transportType: TransportType;
  [k: string]: unknown;
}
namespace LCAx
{

    public partial class Lcax
    {
        public string ClassificationSystem { get; set; }
        public string Comment { get; set; }
        public string Description { get; set; }
        public Dictionary<string, Assembly> EmissionParts { 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 long? LifeSpan { get; set; }
        public string Location { get; set; }
        public Dictionary<string, string> MetaData { get; set; }
        public string Name { get; set; }
        public Dictionary<string, Dictionary<string, double>> Results { 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, EpdPart> Parts { 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 EpdPart
    {
        public EpdSource EpdSource { get; set; }
        public string Id { get; set; }
        public Dictionary<string, string> MetaData { get; set; }
        public string Name { get; set; }
        public double PartQuantity { get; set; }
        public Unit PartUnit { get; set; }
        public double ReferenceServiceLife { get; set; }
        public Transport Transport { get; set; }
    }

    public partial class EpdSource
    {
        public Epd Epd { get; set; }
        public ExternalEpd Externalepd { get; set; }
        public InternalEpd Internalepd { get; set; }
    }

    public partial class Epd
    {
        public ImpactCategory Adpe { get; set; }
        public ImpactCategory Adpf { get; set; }
        public ImpactCategory Ap { get; set; }
        public string Comment { get; set; }
        public Conversion[] Conversions { get; set; }
        public ImpactCategory Cru { get; set; }
        public Unit DeclaredUnit { get; set; }
        public ImpactCategory Eee { get; set; }
        public ImpactCategory Eet { get; set; }
        public ImpactCategory Ep { get; set; }
        public string FormatVersion { get; set; }
        public ImpactCategory Fw { get; set; }
        public ImpactCategory Gwp { get; set; }
        public ImpactCategory Hwd { get; set; }
        public string Id { get; set; }
        public string Location { get; set; }
        public ImpactCategory Mer { get; set; }
        public Dictionary<string, string> MetaData { get; set; }
        public ImpactCategory Mrf { get; set; }
        public string Name { get; set; }
        public ImpactCategory Nhwd { get; set; }
        public ImpactCategory Nrsf { get; set; }
        public ImpactCategory Odp { get; set; }
        public ImpactCategory Penre { get; set; }
        public ImpactCategory Penrm { get; set; }
        public ImpactCategory Penrt { get; set; }
        public ImpactCategory Pere { get; set; }
        public ImpactCategory Perm { get; set; }
        public ImpactCategory Pert { get; set; }
        public ImpactCategory Pocp { get; set; }
        public DateTimeOffset PublishedDate { get; set; }
        public long? ReferenceServiceLife { get; set; }
        public ImpactCategory Rsf { get; set; }
        public ImpactCategory Rwd { get; set; }
        public ImpactCategory Sm { 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 ImpactCategory
    {
        public double? A1A3 { get; set; }
        public double? A4 { get; set; }
        public double? A5 { get; set; }
        public double? B1 { get; set; }
        public double? B2 { get; set; }
        public double? B3 { get; set; }
        public double? B4 { get; set; }
        public double? B5 { get; set; }
        public double? B6 { get; set; }
        public double? B7 { get; set; }
        public double? C1 { get; set; }
        public double? C2 { get; set; }
        public double? C3 { get; set; }
        public double? C4 { get; set; }
        public double? D { get; set; }
    }

    public partial class Conversion
    {
        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 ExternalEpd
    {
        public string Format { get; set; }
        public string Url { get; set; }
        public string Version { get; set; }
    }

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

    public partial class Transport
    {
        public double Distance { get; set; }
        public DistanceUnit DistanceUnit { get; set; }
        public string Id { get; set; }
        public string Name { get; set; }
        public TransportType TransportType { get; set; }
    }

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

    public enum Standard { En15804A1, En15804A2, Unknown };

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

    public enum DistanceUnit { Km, M };

    public enum TransportType { Plane, Ship, Train, Truck };

    public enum ImpactCategoryKey { Adpe, Adpf, Ap, Cru, Eee, Eet, Ep, Fw, Gwp, Hwd, Mer, Mrf, Nhwd, Nrsf, Odp, Penre, Penrm, Penrt, Pere, Perm, Pert, Pocp, Rsf, Rwd, Sm };

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

Download