<?php

namespace App\Pricing\Repository;

use App\Appointment\Entity\Appointment;
use App\Pricing\Entity\PriceSnapshot;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

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

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