# generated by datamodel-codegen:
#   filename:  lcax.schema.json
#   timestamp: 2023-08-21T08:30:27+00:00

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, conint


class Classification(BaseModel):
    code: str
    name: str
    system: str


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


class ExternalEPD(BaseModel):
    format: str
    url: str
    version: Optional[str] = None


class ImpactCategory(BaseModel):
    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):
    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):
    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 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'
    M2R1 = 'M2R1'
    UNKNOWN = 'UNKNOWN'


class Conversion(BaseModel):
    to: Unit
    value: float


class EPD(BaseModel):
    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[conint(ge=0)] = None
    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 EPDSourceItem(BaseModel):
    class Config:
        extra = Extra.forbid

    epd: EPD


class EPDSourceItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    externalepd: ExternalEPD


class EPDSourceItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    internalepd: InternalEPD


class EPDSource(BaseModel):
    __root__: Union[EPDSourceItem, EPDSourceItem1, EPDSourceItem2]


class Transport(BaseModel):
    distance: float
    distanceUnit: DistanceUnit
    id: str
    name: str
    transportType: TransportType


class EPDPart(BaseModel):
    epdSource: EPDSource
    id: str
    metaData: Optional[Dict[str, Any]] = None
    name: str
    partQuantity: float
    partUnit: Unit
    referenceServiceLife: float
    transport: Optional[Transport] = None


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


class LCAxProject(BaseModel):
    classificationSystem: Optional[str] = None
    comment: Optional[str] = None
    description: str
    emissionParts: Dict[str, Assembly]
    formatVersion: str
    id: str
    impactCategories: List[ImpactCategoryKey]
    lciaMethod: Optional[str] = None
    lifeCycleStages: List[LifeCycleStage]
    lifeSpan: Optional[conint(ge=0)] = None
    location: str
    metaData: Optional[Dict[str, Any]] = None
    name: str
    results: Optional[Dict[str, Any]] = None
