<?php

namespace App\Course\Repository;

use App\Appointment\Entity\Appointment;
use App\Course\Entity\CourseSession;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/** @extends ServiceEntityRepository<CourseSession> */
class CourseSessionRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, CourseSession::class);
    }

    public function findByUuid(string $uuid): ?CourseSession
    {
        return $this->findOneBy(['uuid' => $uuid]);
    }

    public function findForAppointment(Appointment $appointment): ?CourseSession
    {
        return $this->findOneBy(['appointment' => $appointment]);
    }
}
