Model/infrastructure/epc/epc_client.py

41 lines
1.2 KiB
Python

from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Optional
from datatypes.epc.domain.epc_property_data import EpcPropertyData
from datatypes.epc.search import EpcSearchResult
class EpcClient(ABC):
"""Interface for retrieving EPC (Energy Performance Certificate) data.
Implementations fetch from a data source and return domain objects;
callers depend only on this interface, not on a concrete transport.
"""
@abstractmethod
def search_by_postcode(self, postcode: str) -> list[EpcSearchResult]:
"""Return the EPC certificates registered at ``postcode``.
Returns an empty list when the postcode has no certificates.
"""
...
@abstractmethod
def get_by_certificate_number(
self, certificate_number: str
) -> EpcPropertyData:
"""Return the full EPC record for a certificate number.
Raises EpcNotFoundError when no such certificate exists.
"""
...
@abstractmethod
def get_by_uprn(self, uprn: int) -> Optional[EpcPropertyData]:
"""Return the most recent EPC record for ``uprn``.
Returns None when the UPRN has no certificates.
"""
...