<?php

declare(strict_types=1);

namespace App\Administration\Domain\Repository;

use App\Administration\Domain\Model\User\Email;
use App\Administration\Domain\Model\User\User;
use App\Administration\Domain\Model\User\UserId;
use App\Shared\Domain\Tenant\TenantId;

interface UserRepository
{
    public function save(User $user): void;

    /**
     * @throws \App\Administration\Domain\Exception\UserNotFoundException
     */
    public function get(UserId $id): User;

    public function findById(UserId $id): ?User;

    /**
     * Finds a user by email within a specific tenant.
     * Returns null if user doesn't exist in that tenant.
     */
    public function findByEmail(Email $email, TenantId $tenantId): ?User;

    /**
     * Returns all users for a given tenant.
     *
     * @return User[]
     */
    public function findAllByTenant(TenantId $tenantId): array;

    /**
     * Returns all students (ROLE_ELEVE) for a given tenant.
     *
     * @return User[]
     */
    public function findStudentsByTenant(TenantId $tenantId): array;
}
