from __future__ import annotations

from dataclasses import dataclass
from typing import Optional


@dataclass
class EpcSearchResult:
    certificate_number: str
    address_line_1: str
    address_line_2: Optional[str]
    address_line_3: Optional[str]
    address_line_4: Optional[str]
    postcode: str
    post_town: str
    uprn: Optional[int]
    current_energy_efficiency_band: str
    registration_date: str

    @property
    def full_address(self) -> str:
        parts = [
            self.address_line_1,
            self.address_line_2,
            self.address_line_3,
            self.address_line_4,
        ]
        return ", ".join(p for p in parts if p)
