from typing import List

from sziszapangma.integration.repository.experiment_repository import ExperimentRepository

from .record_id_iterator import RecordIdIterator
from .task.processing_task import ProcessingTask


class ExperimentManager:
    _experiment_repository: ExperimentRepository
    _record_id_iterator: RecordIdIterator
    _processing_tasks: List[ProcessingTask]

    def __init__(
        self,
        experiment_repository: ExperimentRepository,
        record_id_iterator: RecordIdIterator,
        processing_tasks: List[ProcessingTask],
    ):
        self._experiment_repository = experiment_repository
        self._record_id_iterator = record_id_iterator
        self._processing_tasks = processing_tasks

    def process(self):
        self._experiment_repository.initialise()
        for processing_task in self._processing_tasks:
            processing_task.process(self._record_id_iterator, self._experiment_repository)