<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace App\Controller\Admin;

use App\Entity\Adresse;
use App\Entity\Agent;
use App\Entity\AgentAppareil;
use App\Entity\AgentGps;
use App\Entity\AgentQualification;
use App\Entity\AgentRestriction;
use App\Entity\Appareil;
use App\Entity\CategoriePlanification;
use App\Entity\EquipementFamille;
use App\Entity\Groupe;
use App\Entity\Intervention;
use App\Entity\LockEntites;
use App\Entity\MotifTempsPartiel;
use App\Entity\Post;
use App\Entity\Site;
use App\Entity\TypeEmail;
use App\Entity\TypePlanification;
use App\Entity\TypeTel;
use App\Entity\Utilisateur;
use App\Entity\UtilisateurAdresse;
use App\Entity\UtilisateurAffectation;
use App\Entity\UtilisateurEmail;
use App\Entity\UtilisateurProfil;
use App\Entity\UtilisateurTel;
use App\Form\AgentType;
use App\Form\PostType;
use App\Form\UtilisateurType;
use App\Repository\PostRepository;
use App\Security\PostVoter;
use App\Service\FiltreManager;
use App\Service\LockManager;
use App\Utils\Functions;
use DateTime;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Security\Core\Security;

/**
 * Controller used to manage blog contents in the backend.
 *
 * Please note that the application backend is developed manually for learning
 * purposes. However, in your real Symfony application you should use any of the
 * existing bundles that let you generate ready-to-use backends without effort.
 *
 * See http://knpbundles.com/keyword/admin
 *
 * @Route("/lock")
 * @IsGranted("ROLE_USER")
 *
 */
class LockController extends ParentAdminController
{
    /**
     * @Route("/{id}", name="delete_lock", methods={"DELETE"})
     */
    public function deleteLock(LockEntites $lock, LockManager $lockManager): JsonResponse
    {
        $em = $this->getDoctrine()->getManager();
        if ($lock) {
            $em->remove($lock);
            $em->flush();
        }
        return new JsonResponse(['success' => true]);
    }


}
