<?php

namespace App\Controller;

use App\Entity\Socket;
use App\Form\SocketTypeForm;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[Route('/socket')]
class SocketController extends AbstractController
{
	use FormControllerBase;

	protected const ENTITY        = Socket::class;
	protected const ROUTE_PREFIX  = 'socket_';
	protected const TEMPLATE_PATH = 'socket/';
	protected const FORM          = SocketTypeForm::class;

    #[Route('/', name: 'socket_index', methods: ['GET'])]
    public function index(): Response
    {
		return $this->itemListView('sockets');
    }

    #[Route('/new', name: 'socket_new', methods: ['GET', 'POST'])]
    public function new(Request $request): Response
    {
		return $this->itemCreate($request, 'sockets');
    }

    #[Route('/{id}', name: 'socket_show', methods: ['GET'])]
    public function show(Socket $socket): Response
    {
		return $this->itemView($socket, 'socket');
    }

    #[Route('/{id}/edit', name: 'socket_edit', methods: ['GET', 'POST'])]
    public function edit(Request $request, Socket $socket): Response
    {
		return $this->itemUpdate($request, $socket, 'socket');
    }

    #[Route('/{id}', name: 'socket_delete', methods: ['POST'])]
    public function delete(Request $request, Socket $socket): Response
    {
		return $this->deleteCSRF($request, $socket);
    }
}