__author__ = "Johannes Köster"
__copyright__ = "Copyright 2024, Johannes Köster"
__email__ = "johannes.koester@uni-due.de"
__license__ = "MIT"


from abc import ABC, abstractmethod
from typing import List, Mapping, Dict, Optional, Union
from ismk.interfaces.report_plugins.interfaces import (
    CategoryInterface,
    ConfigFileRecordInterface,
    FileRecordInterface,
    JobRecordInterface,
    RuleRecordInterface,
)
from ismk.interfaces.report_plugins.settings import ReportSettingsBase
from ismk.interfaces.report_plugins.interfaces import DAGReportInterface


class ReporterBase(ABC):
    def __init__(
        self,
        rules: Mapping[str, RuleRecordInterface],
        results: Mapping[
            CategoryInterface, Mapping[CategoryInterface, List[FileRecordInterface]]
        ],
        configfiles: List[ConfigFileRecordInterface],
        jobs: List[JobRecordInterface],
        settings: ReportSettingsBase,
        workflow_description: str,
        dag: DAGReportInterface,
        metadata: Optional[
            Dict[str, Union[str, int, float, List[str], List[int], List[float]]]
        ] = None,
    ):
        self.rules = rules
        self.jobs = jobs
        self.results = results
        self.configfiles = configfiles
        self.settings = settings
        self.workflow_description = workflow_description
        self.dag = dag
        self.metadata = metadata

        self.__post_init__()

    def __post_init__(self):
        pass

    @abstractmethod
    def render(self): ...
