"""Domain dataclasses for estimate entities.""" from dataclasses import dataclass, field @dataclass class LaborResource: razryad: float chel_hours: float cost_base: float | None = None @dataclass class MachineResource: code: str name: str unit: str qty: float cost_base: float = 0 razryad_mash: float | None = None @dataclass class MaterialResource: code: str name: str unit: str qty: float cost_base: float = 0 @dataclass class NormResources: norm_code: str norm_name: str | None = None unit: str | None = None ozp: LaborResource | None = None machines: list[MachineResource] = field(default_factory=list) materials: list[MaterialResource] = field(default_factory=list) totals: dict[str, float | None] = field(default_factory=dict) @dataclass class Coefficients: zt: float = 1.0 em: float = 1.0 ztm: float = 1.0 applied: list[str] = field(default_factory=list) formulas: dict[str, str] = field(default_factory=dict) @dataclass class PositionResult: """Result of calculating one estimate position.""" gesn_code: str name: str unit: str qty: float ot_cost: float = 0.0 em_cost: float = 0.0 otm_cost: float = 0.0 mat_cost: float = 0.0 pz: float = 0.0 fot: float = 0.0 nr: float = 0.0 sp: float = 0.0 total: float = 0.0 zt_hours: float = 0.0 ztm_hours: float = 0.0 transport_cost: float = 0.0 is_transport: bool = False is_kp: bool = False is_material: bool = False @dataclass class EstimateResult: """Aggregated result of the entire estimate.""" positions: list[PositionResult] = field(default_factory=list) grand_pz: float = 0.0 grand_ot: float = 0.0 grand_em: float = 0.0 grand_otm: float = 0.0 grand_mat: float = 0.0 grand_transport: float = 0.0 grand_fot: float = 0.0 grand_nr: float = 0.0 grand_sp: float = 0.0 grand_total: float = 0.0 grand_zt_hours: float = 0.0 grand_ztm_hours: float = 0.0 # Лимитированные затраты temp_buildings: float = 0.0 # Временные здания и сооружения temp_buildings_pct: float = 0.0 winter_cost: float = 0.0 # Зимнее удорожание winter_cost_pct: float = 0.0 contingency: float = 0.0 # Резерв на непредвиденные contingency_pct: float = 0.0 grand_total_with_limits: float = 0.0 # Итого с лимитированными