<?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\ShareTestConnectionProvider;
use Symfony\Component\Serializer\Attribute\Groups;

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

    #[Groups(['share_test:read'])]
    public ?string $message = null;
}
