<?php

declare(strict_types=1);

namespace App\Repository;

use App\Entity\AbsencePolicy;
use App\Enum\AbsenceType;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

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

    public function findOneByType(AbsenceType $type): ?AbsencePolicy
    {
        return $this->findOneBy(['type' => $type]);
    }
}
