<?php

declare(strict_types=1);

namespace App\Module\ProjectManagement\Domain\Repository;

use App\Module\ProjectManagement\Domain\Entity\Project;
use App\Module\ProjectManagement\Domain\Entity\Task;
use Doctrine\ORM\QueryBuilder;

interface TaskRepositoryInterface
{
    public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder;

    public function findById(int $id): ?Task;

    /**
     * Returns the max task number for a project, using an advisory lock
     * to prevent race conditions when creating tasks concurrently.
     */
    public function findMaxNumberByProjectForUpdate(Project $project): int;
}
