<?php

namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Processor\DeleteMangaProcessor;
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\DeleteMangaProvider;

#[ApiResource(
    shortName: 'Manga',
    operations: [
        new Delete(
            uriTemplate: '/mangas/{id}',
            provider: DeleteMangaProvider::class,
            processor: DeleteMangaProcessor::class,
            name: 'delete_manga',
            openapiContext: [
                'summary' => 'Delete a manga',
                'description' => 'Permanently deletes a manga and all its associated chapters',
                'parameters' => [
                    [
                        'name' => 'id',
                        'in' => 'path',
                        'required' => true,
                        'schema' => [
                            'type' => 'string'
                        ],
                        'description' => 'The manga ID'
                    ]
                ],
                'responses' => [
                    '204' => [
                        'description' => 'Manga successfully deleted'
                    ],
                    '404' => [
                        'description' => 'Manga not found'
                    ]
                ]
            ]
        )
    ]
)]
class DeleteMangaResource
{
    public function __construct(
        public string $id
    ) {
    }
}
