<?php

namespace App\Controller;

use App\Dto\Input\OrganizationalUnitInput;
use App\Dto\Output\OrganizationalUnitOutput;
use App\Entity\OrganizationalUnit;
use App\Handler\OrganizationalUnitChangeParentHandler;
use App\Repository\OrganizationalUnitRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;

class OrganizationalUnitChangeParentAction extends AbstractController
{
    public function __construct(
        private readonly OrganizationalUnitChangeParentHandler  $organizationalUnitChangeParentHandler
    )
    {

    }

    public function __invoke(OrganizationalUnit $organizationalUnit): JsonResponse
    {
        $this->organizationalUnitChangeParentHandler->handle($organizationalUnit);

        return new JsonResponse(data: 'Organizational unit parent changed successfully', status: Response::HTTP_OK);
    }
}