<?php

declare(strict_types=1);

namespace App\Module\Integration\Infrastructure\ApiPlatform\Resource;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;
use App\Module\Integration\Infrastructure\ApiPlatform\State\BookStackShelfProvider;
use Symfony\Component\Serializer\Attribute\Groups;

#[ApiResource(
    operations: [
        new GetCollection(
            uriTemplate: '/bookstack/shelves',
            normalizationContext: ['groups' => ['bookstack_shelf:read']],
            provider: BookStackShelfProvider::class,
            security: "is_granted('ROLE_ADMIN')",
        ),
    ],
)]
final class BookStackShelf
{
    #[Groups(['bookstack_shelf:read'])]
    public int $id = 0;

    #[Groups(['bookstack_shelf:read'])]
    public string $name = '';
}
