<?php

declare(strict_types=1);

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

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

#[ApiResource(
    operations: [
        new Post(
            uriTemplate: '/settings/bookstack/test',
            input: false,
            normalizationContext: ['groups' => ['bookstack_test:read']],
            provider: BookStackTestConnectionProvider::class,
            processor: BookStackTestConnectionProvider::class,
            security: "is_granted('ROLE_ADMIN')",
        ),
    ],
)]
final class BookStackTestConnection
{
    #[Groups(['bookstack_test:read'])]
    public bool $success = false;
}
