from __future__ import annotations from typing import Any, ClassVar, Optional from sqlalchemy import Column from sqlalchemy.dialects.postgresql import JSONB from sqlmodel import Field, SQLModel class SolarBuildingInsightsRow(SQLModel, table=True): """Persisted Google Solar `buildingInsights` response for one Property. Stored as JSONB — the raw fetched insights are retained whole so the structured projection a future SolarPotential type needs can be derived without re-fetching. One row per Property. """ __tablename__: ClassVar[str] = "solar_building_insights" # pyright: ignore[reportIncompatibleVariableOverride] id: Optional[int] = Field(default=None, primary_key=True) property_id: int = Field(index=True, unique=True) insights: dict[str, Any] = Field(sa_column=Column(JSONB, nullable=False))