<?php
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
use Ig\IgReservations\Controller\CalendarController;
use Ig\IgReservations\Controller\EventController;
use Ig\IgReservations\Controller\ReservationController;
use Ig\IgReservations\Controller\AjaxController;
use Ig\IgReservations\Controller\FeUserController;
use Ig\IgReservations\Controller\LocationController;
use Ig\IgReservations\Controller\StatisticController;
use Ig\IgReservations\Upgrades\PluginToCTypeUpgradeWizard;

defined('TYPO3') || die('Access denied.');


ExtensionUtility::configurePlugin(
    'IgReservations',
    'CalendarList',
    [
        CalendarController::class => 'list',
    ],
    // non-cacheable actions
    [
        CalendarController::class => 'list',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
    'IgReservations',
    'PublicCalendar',
    [
        CalendarController::class => 'show, list',
        EventController::class => 'new, create, edit, update, delete, deleteConfirm, confirm, cut, insert, uncut',
        ReservationController::class => 'new, create, delete, deleteConfirm, cancelRequest, cancelRequestSent',
    ],
    // non-cacheable actions
    [
        CalendarController::class => 'show',
        EventController::class => 'new, create, edit, update, delete, deleteConfirm, confirm, cut, insert, uncut',
        ReservationController::class => 'new, create, delete, deleteConfirm, cancelRequest, cancelRequestSent',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
    'IgReservations',
    'Ajax',
    [
        AjaxController::class => 'frontendUserForm, guestForm, eventShow, reservationCreateForm, reservationEditForm, reservationRemove, reservationCreate, approveEvent, assignTeammember, teammemberAssignmentForm,reservationCreateFormStartEnd, getEvents, updateEvent, ajaxUpload',
    ],
    // non-cacheable actions
    [
        AjaxController::class => 'frontendUser, guestForm, eventShow, reservationCreateForm, reservationEditForm, reservationRemove, reservationCreate, approveEvent, assignTeammember, teammemberAssignmentForm, getEvents, updateEvent, ajaxUpload',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
    'IgReservations',
    'EventTodo',
    [
        EventController::class => 'approvalList, approve, unapprove, show, assignUser, updateTeammember, new, create, edit, update, delete, deleteConfirm, confirm, ajaxUpload',
        ReservationController::class => 'addToEvent, new, create, delete, deleteConfirm, edit, update, showCancelRequest, approveCancelRequest, unapproveCancelRequest, ajaxUpload',
    ],
    // non-cacheable actions
    [
        EventController::class => 'approvalList, approve, unapprove, show, assignUser, updateTeammember, new, create, edit, update, delete, deleteConfirm, confirm, ajaxUpload',
        ReservationController::class => 'addToEvent, new, create, delete, deleteConfirm, edit, update, showCancelRequest, approveCancelRequest, unapproveCancelRequest, ajaxUpload',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);


ExtensionUtility::configurePlugin(
    'IgReservations',
    'Overview',
    [
        CalendarController::class => 'overview, pdfExport',
    ],
    // non-cacheable actions
    [
        CalendarController::class => 'overview, pdfExport',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);


ExtensionUtility::configurePlugin(
    'IgReservations',
    'EventList',
    [
        EventController::class => 'list',
        ReservationController::class => 'newBooking,createBooking,thankYouBooking,failedBooking',
    ],
    // non-cacheable actions
    [
        EventController::class => 'list',
        ReservationController::class => 'newBooking,createBooking,thankYouBooking,failedBooking',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
    'IgReservations',
    'FeUserManagement',
    [
        FeUserController::class => 'managementList,new,create,edit,update,delete',
    ],
    // non-cacheable actions
    [
        FeUserController::class => 'managementList,new,create,edit,update,delete',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
    'IgReservations',
    'LocationManagement',
    [
        LocationController::class => 'managementList,new,create,edit,update,delete',
    ],
    // non-cacheable actions
    [
        LocationController::class => 'managementList,new,create,edit,update,delete',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
    'IgReservations',
    'LocationList',
    [
        LocationController::class => 'list',
    ],
    // non-cacheable actions
    [
        LocationController::class => 'list',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
    'IgReservations',
    'Alarm',
    [
        EventController::class => 'alarmAdmin',
    ],
    // non-cacheable actions
    [
        EventController::class => 'alarmAdmin',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);


ExtensionUtility::configurePlugin(
    'IgReservations',
    'MyReservations',
    [
        ReservationController::class => 'list, cancelRequest, cancelRequestSent',
    ],
    // non-cacheable actions
    [
        ReservationController::class => 'list, cancelRequest, cancelRequestSent',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
    'IgReservations',
    'Statistics',
    [
        StatisticController::class => 'show, export',
    ],
    // non-cacheable actions
    [
        StatisticController::class => 'show, export',
    ],
    ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);


$GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'][1591182943] = 'EXT:ig_reservations/Resources/Private/Email/Layouts/';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths'][1591182943] = 'EXT:ig_reservations/Resources/Private/Email/Partials/';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'][1591182943] = 'EXT:ig_reservations/Resources/Private/Email/Templates/';

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['igReservationsPluginToCType']
    = PluginToCTypeUpgradeWizard::class;
