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

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