94 lines
1.8 KiB
Python
94 lines
1.8 KiB
Python
|
|
# generated by datamodel-codegen:
|
||
|
|
# filename: envelope.json
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from enum import StrEnum
|
||
|
|
|
||
|
|
from pydantic import (
|
||
|
|
AwareDatetime,
|
||
|
|
BaseModel,
|
||
|
|
ConfigDict,
|
||
|
|
Field,
|
||
|
|
RootModel,
|
||
|
|
conint,
|
||
|
|
constr,
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
class ProposalType(StrEnum):
|
||
|
|
BID = 'BID'
|
||
|
|
INVITATION = 'INVITATION'
|
||
|
|
CONTROL_PLAN = 'CONTROL_PLAN'
|
||
|
|
DISPATCH_PLAN = 'DISPATCH_PLAN'
|
||
|
|
|
||
|
|
|
||
|
|
class Timescale(StrEnum):
|
||
|
|
ANNUAL = 'ANNUAL'
|
||
|
|
MONTHLY = 'MONTHLY'
|
||
|
|
DAY_AHEAD = 'DAY_AHEAD'
|
||
|
|
INTRADAY = 'INTRADAY'
|
||
|
|
REALTIME = 'REALTIME'
|
||
|
|
|
||
|
|
|
||
|
|
class Scope(BaseModel):
|
||
|
|
model_config = ConfigDict(
|
||
|
|
extra='forbid',
|
||
|
|
)
|
||
|
|
proposal_type: ProposalType
|
||
|
|
timescales: list[Timescale] = Field(..., min_length=1)
|
||
|
|
resource_set: constr(min_length=1)
|
||
|
|
|
||
|
|
|
||
|
|
class Validity(BaseModel):
|
||
|
|
model_config = ConfigDict(
|
||
|
|
extra='forbid',
|
||
|
|
)
|
||
|
|
from_: AwareDatetime = Field(..., alias='from')
|
||
|
|
to: AwareDatetime
|
||
|
|
|
||
|
|
|
||
|
|
class Level(StrEnum):
|
||
|
|
L1 = 'L1'
|
||
|
|
L2 = 'L2'
|
||
|
|
L3 = 'L3'
|
||
|
|
|
||
|
|
|
||
|
|
class ApprovedByItem(RootModel[constr(min_length=1)]):
|
||
|
|
root: constr(min_length=1)
|
||
|
|
|
||
|
|
|
||
|
|
class Approval(BaseModel):
|
||
|
|
model_config = ConfigDict(
|
||
|
|
extra='forbid',
|
||
|
|
)
|
||
|
|
level: Level
|
||
|
|
approved_by: list[ApprovedByItem] = Field(..., min_length=1)
|
||
|
|
|
||
|
|
|
||
|
|
class Escalation(BaseModel):
|
||
|
|
model_config = ConfigDict(
|
||
|
|
extra='forbid',
|
||
|
|
)
|
||
|
|
max_consecutive_deviations: conint(le=9007199254740991, gt=0)
|
||
|
|
deviation_threshold_pct: constr(pattern=r'^-?\d+(\.\d+)?$')
|
||
|
|
|
||
|
|
|
||
|
|
class Status(StrEnum):
|
||
|
|
ACTIVE = 'ACTIVE'
|
||
|
|
SUSPENDED = 'SUSPENDED'
|
||
|
|
EXPIRED = 'EXPIRED'
|
||
|
|
|
||
|
|
|
||
|
|
class Envelope(BaseModel):
|
||
|
|
model_config = ConfigDict(
|
||
|
|
extra='forbid',
|
||
|
|
)
|
||
|
|
id: constr(min_length=1)
|
||
|
|
scope: Scope
|
||
|
|
bounds: dict[str, constr(pattern=r'^-?\d+(\.\d+)?$')]
|
||
|
|
validity: Validity
|
||
|
|
approval: Approval
|
||
|
|
escalation: Escalation
|
||
|
|
status: Status
|