mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import ClassVar, Optional
|
|
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
|
|
class MaterialRow(SQLModel, table=True):
|
|
"""Defensive view of the externally-owned ``material`` catalogue table.
|
|
|
|
Declares only the columns the modelling backend reads to price a Measure
|
|
Option; other columns (r-values, labour breakdowns, etc.) are left off so
|
|
schema churn elsewhere doesn't ripple in. `total_cost` is the fully-loaded
|
|
cost per the row's `cost_unit` (GBP/m^2 for fabric measures).
|
|
"""
|
|
|
|
__tablename__: ClassVar[str] = "material" # pyright: ignore[reportIncompatibleVariableOverride]
|
|
|
|
id: int = Field(primary_key=True)
|
|
type: str
|
|
total_cost: Optional[float] = Field(default=None)
|
|
cost_unit: Optional[str] = Field(default=None)
|
|
description: Optional[str] = Field(default=None)
|
|
is_active: bool = Field(default=True)
|
|
# Whether a solar_pv Option's product bundle includes a battery; the Scenario
|
|
# Export reads it to pivot solar-with-battery to its own column (ADR-0065).
|
|
includes_battery: bool = Field(default=False)
|