<?php

declare(strict_types=1);

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

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

#[ApiResource(
    operations: [
        new Get(
            uriTemplate: '/tasks/{taskId}/gitea/branch-name/{type}',
            normalizationContext: ['groups' => ['gitea_branch_name:read']],
            provider: GiteaBranchNameProvider::class,
            security: "is_granted('ROLE_USER')",
        ),
    ],
)]
final class GiteaBranchName
{
    #[Groups(['gitea_branch_name:read'])]
    public string $name = '';
}
