import logging

from gateway_core.application.ports.NotificationPort import NotificationPort
from gateway_core.domain.SystemInfoData import SystemInfoDto, BoardInfo, PlugInfo, PlugType, SimCardDto, OCPPDto, \
    PowerUnitInfo

logger = logging.getLogger(__name__)

class SystemInfoUseCase:
    def __init__(self, notifier: NotificationPort):
        self._notifier: NotificationPort = notifier

    async def execute(self):
        # TODO gather all necessary information
        systemInfoDto = SystemInfoDto(serialNumber="Dummy_Serial_Number",
                                      modelName="12345",
                                      jsonShemaVersion="1.0.0",
                                      boardInfos=[BoardInfo(type="ControlBoard", ecpVersion="4.4.0", configVersion="1.0.0")],
                                      plugInfos=[PlugInfo(type=PlugType.CCS, ocppConnectorId=1), PlugInfo(type=PlugType.AC, ocppConnectorId=2)],
                                      cardReader=["Payter-P6X-Series", "CloudTerminal"],
                                      fiscalModule=["1.6.4"],
                                      router=["RUT9_R_00.07.02.7"],
                                      GPS="52.2938,4.7172",
                                      simCard=[SimCardDto(IPv4IP="1.1.2.3", ICCID="8944501909193253652")],
                                      ocpp=[OCPPDto(backendUrl="https://ocpp.example.ch", boxID="SR-1", enabled=True)],
                                      powerUnits=[PowerUnitInfo(type="DELTA_GW", canId=[1, 2, 3, 4]), PowerUnitInfo(type="AC", canId=[])],
                                      gridCurrent=200)

        await self._notifier.notifySystemInfo(systemInfoDto)
