Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/bo4e/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"ComTyp",
"Dienstleistung",
"Dienstleistungstyp",
"DynamischePreiszeitreihe",
"EMobilitaetsart",
"EinheitsPreisposition",
"Energieherkunft",
Expand Down Expand Up @@ -117,6 +118,8 @@
"Preisstaffel",
"Preisstatus",
"Preistyp",
"Preiszeitreihe",
"Preiszeitreihenwert",
"Profilart",
"Profiltyp",
"Profilverfahren",
Expand Down Expand Up @@ -212,6 +215,7 @@
from .bo.ausschreibung import Ausschreibung
from .bo.bilanzierung import Bilanzierung
from .bo.buendelvertrag import Buendelvertrag
from .bo.dynamischepreiszeitreihe import DynamischePreiszeitreihe
from .bo.energiemenge import Energiemenge
from .bo.fremdkosten import Fremdkosten
from .bo.geraet import Geraet
Expand Down Expand Up @@ -277,6 +281,8 @@
from .com.preisgarantie import Preisgarantie
from .com.preisposition import Preisposition
from .com.preisstaffel import Preisstaffel
from .com.preiszeitreihe import Preiszeitreihe
from .com.preiszeitreihenwert import Preiszeitreihenwert
from .com.rechnungsposition import Rechnungsposition
from .com.regionsoperation import Regionsoperation
from .com.regionspreis import Regionspreis
Expand Down
40 changes: 40 additions & 0 deletions src/bo4e/bo/dynamischepreiszeitreihe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""
Contains DynamischePreiszeitreihe class
"""

from typing import TYPE_CHECKING, Annotated, Literal, Optional

from pydantic import Field

from ..enum.botyp import BoTyp
from ..utils import postprocess_docstring
from .geschaeftsobjekt import Geschaeftsobjekt

if TYPE_CHECKING:
from ..com.preiszeitreihe import Preiszeitreihe
from .marktlokation import Marktlokation
from .zaehler import Zaehler


@postprocess_docstring
class DynamischePreiszeitreihe(Geschaeftsobjekt):
"""
Abbildung einer dynamischen Preiszeitreihe.

.. raw:: html

<object data="../_static/images/bo4e/bo/DynamischePreiszeitreihe.svg" type="image/svg+xml"></object>

.. HINT::
`DynamischePreiszeitreihe JSON Schema <https://json-schema.app/view/%23?url=https://raw.githubusercontent.com/BO4E/BO4E-Schemas/{__gh_version__}/src/bo4e_schemas/bo/DynamischePreiszeitreihe.json>`_

"""

typ: Annotated[Literal[BoTyp.DYNAMISCHEPREISZEITREIHE], Field(alias="_typ")] = BoTyp.DYNAMISCHEPREISZEITREIHE

marktlokation: Optional["Marktlokation"] = None
"""Marktlokation der dynamischen Preiszeitreihe"""
zaehler: Optional["Zaehler"] = None
"""Zaehler der dynamischen Preiszeitreihe"""
preiszeitreihen: list["Preiszeitreihe"] | None = None
"""Werte der Preiszeitreihe"""
42 changes: 42 additions & 0 deletions src/bo4e/com/preiszeitreihe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
Contains Preiszeitreihe
"""

from typing import TYPE_CHECKING, Annotated, Literal, Optional

from pydantic import Field

from ..enum.comtyp import ComTyp
from ..utils import postprocess_docstring
from .com import COM

if TYPE_CHECKING:
from ..enum.preistyp import Preistyp
from .preiszeitreihenwert import Preiszeitreihenwert


@postprocess_docstring
class Preiszeitreihe(COM):
"""

Gibt Bezeichnung und Preisart zu einer Preiszeitreihe an

.. raw:: html

<object data="../_static/images/bo4e/com/Preiszeitreihe.svg" type="image/svg+xml"></object>

.. HINT::
`Preiszeitreihe JSON Schema <https://json-schema.app/view/%23?url=https://raw.githubusercontent.com/BO4E/BO4E-Schemas/{__gh_version__}/src/bo4e_schemas/com/Preiszeitreihe.json>`_

"""

typ: Annotated[Literal[ComTyp.PREISZEITREIHE], Field(alias="_typ")] = ComTyp.PREISZEITREIHE

preiszeitreihe_id: str | None = None
"""Identifier der Preiszeitreihe"""
bezeichnung: str | None = None
"""Bezeichnung der Preiszeitreihe"""
preistyp: Optional["Preistyp"] = None
"""Angabe des Preistyps"""
werte: list["Preiszeitreihenwert"] | None = None
"""Liste der Preiszeitreihenwerte, die die Preiszeitreihe bilden"""
40 changes: 40 additions & 0 deletions src/bo4e/com/preiszeitreihenwert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""
Contains Preiszeitreihenwert
"""

from typing import TYPE_CHECKING, Annotated, Literal, Optional

from pydantic import Field

from ..enum.comtyp import ComTyp
from ..utils import postprocess_docstring
from .com import COM

if TYPE_CHECKING:
from .menge import Menge
from .preis import Preis
from .zeitraum import Zeitraum


@postprocess_docstring
class Preiszeitreihenwert(COM):
"""
Gibt einen Wert und Preis zu einer Zeitreihe an

.. raw:: html

<object data="../_static/images/bo4e/com/Preiszeitreihenwert.svg" type="image/svg+xml"></object>

.. HINT::
`Preiszeitreihenwert JSON Schema <https://json-schema.app/view/%23?url=https://raw.githubusercontent.com/BO4E/BO4E-Schemas/{__gh_version__}/src/bo4e_schemas/com/Preiszeitreihenwert.json>`_

"""

typ: Annotated[Literal[ComTyp.PREISZEITREIHENWERT], Field(alias="_typ")] = ComTyp.PREISZEITREIHENWERT

zeitraum: Optional["Zeitraum"] = None
"""Zeitraum des Preiszeitreihenwerts"""
preis: Optional["Preis"] = None
"""Preis des Preiszeitreihenwerts"""
menge: Optional["Menge"] = None
"""Menge des Preiszeitreihenwerts"""
1 change: 1 addition & 0 deletions src/bo4e/enum/botyp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class BoTyp(StrEnum):
AUSSCHREIBUNG = "AUSSCHREIBUNG"
BILANZIERUNG = "BILANZIERUNG"
BUENDELVERTRAG = "BUENDELVERTRAG"
DYNAMISCHEPREISZEITREIHE = "DYNAMISCHEPREISZEITREIHE"
ENERGIEMENGE = "ENERGIEMENGE"
FREMDKOSTEN = "FREMDKOSTEN"
GERAET = "GERAET"
Expand Down
2 changes: 2 additions & 0 deletions src/bo4e/enum/comtyp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class ComTyp(StrEnum):
PREISGARANTIE = "PREISGARANTIE"
PREISPOSITION = "PREISPOSITION"
PREISSTAFFEL = "PREISSTAFFEL"
PREISZEITREIHE = "PREISZEITREIHE"
PREISZEITREIHENWERT = "PREISZEITREIHENWERT"
RECHNUNGSPOSITION = "RECHNUNGSPOSITION"
REGIONSOPERATION = "REGIONSOPERATION"
REGIONSPREIS = "REGIONSPREIS"
Expand Down
2 changes: 2 additions & 0 deletions src/bo4e/enum/preistyp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ class Preistyp(StrEnum):
"""Entgelt für MSB (Entgelt für Einbau, Betrieb und Wartung der Messtechnik)"""
PROVISION = "PROVISION"
"""Provision"""
GESAMTPREIS_BRUTTO = "GESAMTPREIS_BRUTTO"
"""Brutto Gesamtpreis"""
24 changes: 24 additions & 0 deletions tests/test_dynamische_preiszeitreihe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pytest

from bo4e import DynamischePreiszeitreihe, Marktlokation, Preiszeitreihe, Zaehler
from tests.serialization_helper import assert_serialization_roundtrip


class TestPreiszeitreihe:
@pytest.mark.parametrize(
"dynamische_preiszeitreihe",
[
pytest.param(
DynamischePreiszeitreihe(
marktlokation=Marktlokation(),
zaehler=Zaehler(),
preiszeitreihen=[Preiszeitreihe()],
)
),
],
)
def test_serialization_roundtrip(self, dynamische_preiszeitreihe: DynamischePreiszeitreihe) -> None:
"""
Test de-/serialisation of Preiszeitreihe
"""
assert_serialization_roundtrip(dynamische_preiszeitreihe)
25 changes: 25 additions & 0 deletions tests/test_preiszeitreihe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pytest

from bo4e import Preiszeitreihe, Preiszeitreihenwert, Preistyp
from tests.serialization_helper import assert_serialization_roundtrip


class TestPreiszeitreihe:
@pytest.mark.parametrize(
"preiszeitreihe",
[
pytest.param(
Preiszeitreihe(
preiszeitreihe_id="1-2-3",
bezeichnung="Bezeichnung",
preistyp=Preistyp.GESAMTPREIS_BRUTTO,
werte=[Preiszeitreihenwert()],
)
),
],
)
def test_serialization_roundtrip(self, preiszeitreihe: Preiszeitreihe) -> None:
"""
Test de-/serialisation of Preiszeitreihe
"""
assert_serialization_roundtrip(preiszeitreihe)
24 changes: 24 additions & 0 deletions tests/test_preiszeitreihenwert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pytest

from bo4e import Menge, Preis, Preiszeitreihenwert, Zeitraum
from tests.serialization_helper import assert_serialization_roundtrip


class TestPreiszeitreihenwert:
@pytest.mark.parametrize(
"preiszeitreihenwert",
[
pytest.param(
Preiszeitreihenwert(
zeitraum=Zeitraum(),
preis=Preis(),
menge=Menge(),
)
),
],
)
def test_serialization_roundtrip(self, preiszeitreihenwert: Preiszeitreihenwert) -> None:
"""
Test de-/serialisation of Preiszeitreihenwert
"""
assert_serialization_roundtrip(preiszeitreihenwert)
Loading