<?php

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

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use App\Domain\Setting\Infrastructure\ApiPlatform\State\Processor\DeleteContentSourceStateProcessor;
use App\Domain\Setting\Infrastructure\ApiPlatform\State\Provider\DeleteContentSourceStateProvider;

#[ApiResource(
    shortName: 'ContentSource',
    operations: [
        new Delete(
            uriTemplate: '/content-sources/{id}',
            provider: DeleteContentSourceStateProvider::class,
            processor: DeleteContentSourceStateProcessor::class,
            name: 'delete_content_source',
            openapiContext: [
                'summary' => 'Delete a content source',
                'description' => 'Permanently deletes a content source',
                'parameters' => [
                    [
                        'name' => 'id',
                        'in' => 'path',
                        'required' => true,
                        'schema' => [
                            'type' => 'integer'
                        ],
                        'description' => 'The content source ID'
                    ]
                ],
                'responses' => [
                    '204' => [
                        'description' => 'Content source successfully deleted'
                    ],
                    '404' => [
                        'description' => 'Content source not found'
                    ]
                ]
            ]
        )
    ]
)]
class DeleteContentSourceResource
{
    public function __construct(
        public int $id
    ) {
    }
}
