<?php

/**
 * @package         Tassos Code Snippets
 * @version         1.0.1-RC2 Free
 *
 * @author          Tassos Marinos <info@tassos.gr>
 * @link            https://www.tassos.gr
 * @copyright       Copyright © 2026 Tassos Marinos All Rights Reserved
 * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
 */

namespace Tassos\CodeSnippets\Administrator\Controller;

defined('_JEXEC') or die;

use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Router\Route;

/**
 * Snippet controller class.
 */
class SnippetController extends FormController
{
    /**
     * The prefix to use with controller messages.
     *
     * @var    string
     */
    protected $text_prefix = 'COM_TASSOSCODESNIPPETS_SNIPPET';

    /**
     * The option for this component.
     *
     * @var    string
     */
    protected $option = 'com_tassoscodesnippets';

    /**
     * Method to run batch operations.
     *
     * @param   object  $model  The model.
     *
     * @return  boolean  True if successful, false otherwise and internal error is set.
     */
    public function batch($model = null)
    {
        $this->checkToken();

        $model = $this->getModel('Snippet', 'Administrator', []);

        $this->setRedirect(Route::_('index.php?option=com_tassoscodesnippets&view=snippets' . $this->getRedirectToListAppend(), false));

        return parent::batch($model);
    }
}
