<?php

namespace Lc\CaracoleBundle\Controller\Ticket;

use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Definition\ActionDefinition;
use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController;

abstract class TicketAdminController extends SovTicketAdminController
{
    use AdminControllerTrait;

    public function createEntity(string $entityFqcn)
    {
        return $this->getTicketContainer()
                ->getFactory()
                ->setMerchant($this->getMerchantCurrent())
                ->create();
    }

    public function configureFields(string $pageName): iterable
    {
        return $this->getTicketContainer()->getFieldDefinition()
                ->setMerchant($this->getMerchantCurrent())
                ->getFields($pageName);
    }

    public function configureActions(Actions $actions): Actions
    {
        $actions = parent::configureActions($actions);
        $actions->disable( ActionDefinition::EDIT, ActionDefinition::DUPLICATE,ActionDefinition::DUPLICATE_TO_OTHER_SECTION, ActionDefinition::DELETE);

        return $actions;
    }

}