<?php

declare(strict_types=1);

namespace App\Administration\Domain\Repository;

use App\Administration\Domain\Model\HomeworkRules\EnforcementMode;
use App\Administration\Domain\Model\HomeworkRules\HomeworkRule;
use App\Administration\Domain\Model\User\UserId;
use App\Shared\Domain\Tenant\TenantId;
use DateTimeImmutable;

interface HomeworkRulesHistoryRepository
{
    /**
     * @param HomeworkRule[]|null $previousRules
     * @param HomeworkRule[]      $newRules
     */
    public function record(
        TenantId $tenantId,
        ?array $previousRules,
        array $newRules,
        EnforcementMode $enforcementMode,
        bool $enabled,
        UserId $changedBy,
        DateTimeImmutable $changedAt,
    ): void;

    /**
     * @return array<array{
     *     id: string,
     *     previous_rules: string|null,
     *     new_rules: string,
     *     enforcement_mode: string,
     *     enabled: bool,
     *     changed_by: string,
     *     changed_at: string,
     * }>
     */
    public function findByTenant(TenantId $tenantId, int $limit = 50): array;
}
