import os
from typing import Any, Mapping

from backend.ecmk_fetcher.ecmk_service import EcmkService
from utils.logger import setup_logger
from utils.sharepoint.domna_sharepoint_client import DomnaSharepointClient
from utils.sharepoint.domna_sites import DomnaSites

logger = setup_logger()

_PROPERTY_LIST_FILE: str = (
    "hubspot-crm-exports-southern-ra-lite-programme-3103-2026-03-31-2.xlsx"
)
_BASE_DIR: str = os.path.dirname(os.path.dirname(__file__))


def handler(event: Mapping[str, Any], context: Any) -> None:
    logger.info("Entered handler")
    service = EcmkService(
        sharepoint_client=DomnaSharepointClient(
            sharepoint_location=DomnaSites.PRIVATE_PAY
        ),
        s3_bucket="retrofit-energy-assessments-dev",
        property_list_filepath=os.path.join(_BASE_DIR, _PROPERTY_LIST_FILE),
        sharepoint_base_path="/Projects/Southern Housing/SH-SURV-26-001/Assessments",
        sharepoint_excel_path="/Projects/Southern Housing/SH-SURV-26-001/Modelling",
        local_dimensions_path=os.path.join(_BASE_DIR, "Dimensions.xlsx"),
    )
    service.run()


if __name__ == "__main__":
    event = {"Records": [{"body": "{}"}]}
    handler(event, None)
