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

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