<?php

namespace MintyPHP\Service\Scheduler;

use MintyPHP\Repository\Scheduler\ScheduledJobRepository;
use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository;
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepository;
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepositoryInterface;

class SchedulerRepositoryFactory
{
    private ?ScheduledJobRepository $scheduledJobRepository = null;
    private ?ScheduledJobRunRepository $scheduledJobRunRepository = null;
    private ?SchedulerRuntimeRepository $schedulerRuntimeRepository = null;

    public function createScheduledJobRepository(): ScheduledJobRepositoryInterface
    {
        return $this->scheduledJobRepository ??= new ScheduledJobRepository();
    }

    public function createScheduledJobRunRepository(): ScheduledJobRunRepositoryInterface
    {
        return $this->scheduledJobRunRepository ??= new ScheduledJobRunRepository();
    }

    public function createSchedulerRuntimeRepository(): SchedulerRuntimeRepositoryInterface
    {
        return $this->schedulerRuntimeRepository ??= new SchedulerRuntimeRepository();
    }
}
