<?php

declare(strict_types=1);

namespace App\Administration\Infrastructure\Api\Resource;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;
use App\Administration\Infrastructure\Api\Provider\HomeworkRulesHistoryProvider;

/**
 * DTO représentant une entrée d'historique des règles de devoirs.
 */
#[ApiResource(
    shortName: 'HomeworkRulesHistory',
    operations: [
        new GetCollection(
            uriTemplate: '/settings/homework-rules/history',
            provider: HomeworkRulesHistoryProvider::class,
            name: 'get_homework_rules_history',
        ),
    ],
)]
final class HomeworkRulesHistoryResource
{
    #[ApiProperty(identifier: true)]
    public ?string $id = null;

    /** @var array<int, array{type: string, params: array<string, mixed>}>|null */
    public ?array $previousRules = null;

    /** @var array<int, array{type: string, params: array<string, mixed>}> */
    public array $newRules = [];

    public string $enforcementMode = '';

    public bool $enabled = true;

    public string $changedBy = '';

    public string $changedAt = '';
}
