<?php
defined('TYPO3') || die('Access denied.');


\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'CalendarList',
    [
        \Ig\IgReservations\Controller\CalendarController::class => 'list',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\CalendarController::class => 'list',
    ]
);

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

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'Ajax',
    [
        \Ig\IgReservations\Controller\AjaxController::class => 'frontendUserForm, guestForm, eventShow, reservationCreateForm, reservationEditForm, reservationRemove, reservationCreate, approveEvent, assignTeammember, teammemberAssignmentForm,reservationCreateFormStartEnd, getEvents, updateEvent, ajaxUpload',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\AjaxController::class => 'frontendUser, guestForm, eventShow, reservationCreateForm, reservationEditForm, reservationRemove, reservationCreate, approveEvent, assignTeammember, teammemberAssignmentForm, getEvents, updateEvent, ajaxUpload',
    ],
);
/*
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'AjaxEvents',
    [
        \Ig\IgReservations\Controller\AjaxController::class => 'getEvents',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\AjaxController::class => 'getEvents',
    ],
);
*/

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


\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'Overview',
    [
        \Ig\IgReservations\Controller\CalendarController::class => 'overview, pdfExport',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\CalendarController::class => 'overview, pdfExport',
    ]
);


\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'EventList',
    [
        \Ig\IgReservations\Controller\EventController::class => 'list',
        \Ig\IgReservations\Controller\ReservationController::class => 'newBooking,createBooking,thankYouBooking,failedBooking',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\EventController::class => 'list',
        \Ig\IgReservations\Controller\ReservationController::class => 'newBooking,createBooking,thankYouBooking,failedBooking',
    ]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'FeUserManagement',
    [
        \Ig\IgReservations\Controller\FeUserController::class => 'managementList,new,create,edit,update,delete',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\FeUserController::class => 'managementList,new,create,edit,update,delete',
    ]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'LocationManagement',
    [
        \Ig\IgReservations\Controller\LocationController::class => 'managementList,new,create,edit,update,delete',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\LocationController::class => 'managementList,new,create,edit,update,delete',
    ]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'LocationList',
    [
        \Ig\IgReservations\Controller\LocationController::class => 'list',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\LocationController::class => 'list',
    ]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'Alarm',
    [
        \Ig\IgReservations\Controller\EventController::class => 'alarmAdmin',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\EventController::class => 'alarmAdmin',
    ]
);


\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'MyReservations',
    [
        \Ig\IgReservations\Controller\ReservationController::class => 'list, cancelRequest, cancelRequestSent',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\ReservationController::class => 'list, cancelRequest, cancelRequestSent',
    ]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'IgReservations',
    'Statistics',
    [
        \Ig\IgReservations\Controller\StatisticController::class => 'show, export',
    ],
    // non-cacheable actions
    [
        \Ig\IgReservations\Controller\StatisticController::class => 'show, export',
    ]
);

// wizards
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
    'mod {
            wizards.newContentElement.wizardItems.plugins {
                elements {
                    publiccalendar {
                        iconIdentifier = ig_reservations-plugin-public
                        title = LLL:EXT:ig_reservations/Resources/Private/Language/locallang_db.xlf:tx_ig_reservations_publiccalendar.name
                        description = LLL:EXT:ig_reservations/Resources/Private/Language/locallang_db.xlf:tx_ig_reservations_publiccalendar.description
                        tt_content_defValues {
                            CType = list
                            list_type = igreservations_publiccalendar
                        }
                    }
                }
                show = *
            }
       }'
);
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);

$iconRegistry->registerIcon(
    'ig_reservations-plugin-public',
    \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
    ['source' => 'EXT:ig_reservations/Resources/Public/Icons/user_plugin_public.svg']
);

$iconRegistry->registerIcon(
    'ig_reservations-plugin-protected',
    \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
    ['source' => 'EXT:ig_reservations/Resources/Public/Icons/user_plugin_protected.svg']
);

$iconRegistry->registerIcon(
    'ig_reservations-plugin-alarm',
    \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
    ['source' => 'EXT:ig_reservations/Resources/Public/Icons/user_plugin_alarm.svg']
);


$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/';
