<?php

declare(strict_types=1);

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

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

#[ApiResource(
    operations: [
        new GetCollection(
            uriTemplate: '/gitea/repositories',
            normalizationContext: ['groups' => ['gitea_repo:read']],
            provider: GiteaRepositoryProvider::class,
            security: "is_granted('ROLE_ADMIN')",
        ),
    ],
)]
final class GiteaRepository
{
    #[Groups(['gitea_repo:read'])]
    public string $fullName = '';

    #[Groups(['gitea_repo:read'])]
    public string $name = '';

    #[Groups(['gitea_repo:read'])]
    public string $owner = '';
}
