<?php

declare(strict_types=1);

namespace KupShop\GraphQLBundle\ApiAdmin\Controller;

use KupShop\GraphQLBundle\ApiAdmin\Types\Content\Response\EditableContentMutateResponse;
use KupShop\GraphQLBundle\ApiAdmin\Types\MutateResponse;
use KupShop\GraphQLBundle\ApiAdmin\Util\BlockUpdater;
use KupShop\GraphQLBundle\ApiShared\Types\Content\Input\EditableContentInput;
use KupShop\GraphQLBundle\ApiShared\Types\Content\Input\EditableContentTranslationInput;
use TheCodingMachine\GraphQLite\Annotations\Mutation;

class EditableContentController
{
    public function __construct(
        private BlockUpdater $blockUpdater,
    ) {
    }

    /**
     * Provede aktualizaci editovatelného obsahu.
     */
    #[Mutation]
    public function editableContentUpdate(EditableContentInput $input): EditableContentMutateResponse
    {
        return $this->blockUpdater->updateEditableContent($input);
    }

    /**
     * Provede aktualizaci překladu editovatelného obsahu.
     */
    #[Mutation]
    public function editableContentTranslate(EditableContentTranslationInput $input): MutateResponse
    {
        return new MutateResponse(
            $this->blockUpdater->updateEditableContentTranslation($input)
        );
    }
}
