<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

if (!defined('TYPO3')) {
    die('Access denied.');
}


// Plugin & flexform registration
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'AwardAnzahl',
    'Ausgabe einer bestimmten Anzahl Awards',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'AwardAuswahl',
    'Ausgabe ausgewählter Awards',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'BusinessDetail',
    'Ausgabe Branchenseite (Detailansicht)',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'CaseAnzahl',
    'Ausgabe einer bestimmten Anzahl Cases',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'CaseAuswahl',
    'Ausgabe ausgewählter Cases',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'CaseKategorie',
    'Ausgabe Cases (nach Kategorie)',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'KundenAnzahl',
    'Ausgabe Kunden (fixe Anzahl)',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'KundenAuswahl',
    'Ausgabe Kunden (Auswahl)',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'KundenBranche',
    'Ausgabe Kunden (nach Branche)',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'amadeus_next',
    'KundenDetail',
    'Ausgabe Kundenprojekte (Detailansicht)',
    'EXT:amadeus_next/Resources/Public/Icons/Extension.png'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['amadeusnext_awardanzahl'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    'amadeusnext_awardanzahl',
    // Flexform configuration schema file
    'FILE:EXT:amadeus_next/Configuration/FlexForms/AmdsAwardAmount.xml'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['amadeusnext_awardauswahl'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    'amadeusnext_awardauswahl',
    // Flexform configuration schema file
    'FILE:EXT:amadeus_next/Configuration/FlexForms/AmdsAwardSelection.xml'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['amadeusnext_caseanzahl'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    'amadeusnext_caseanzahl',
    // Flexform configuration schema file
    'FILE:EXT:amadeus_next/Configuration/FlexForms/AmdsCaseAmount.xml'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['amadeusnext_caseauswahl'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    'amadeusnext_caseauswahl',
    // Flexform configuration schema file
    'FILE:EXT:amadeus_next/Configuration/FlexForms/AmdsCaseSelection.xml'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['amadeusnext_casekategorie'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    'amadeusnext_casekategorie',
    // Flexform configuration schema file
    'FILE:EXT:amadeus_next/Configuration/FlexForms/AmdsCaseCategory.xml'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['amadeusnext_kundenanzahl'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    'amadeusnext_kundenanzahl',
    // Flexform configuration schema file
    'FILE:EXT:amadeus_next/Configuration/FlexForms/AmdsClientAmount.xml'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['amadeusnext_kundenbranche'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    'amadeusnext_kundenbranche',
    // Flexform configuration schema file
    'FILE:EXT:amadeus_next/Configuration/FlexForms/AmdsClientCategory.xml'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['amadeusnext_kundendetail'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    'amadeusnext_kundendetail',
    // Flexform configuration schema file
    'FILE:EXT:amadeus_next/Configuration/FlexForms/AmdsClientDetail.xml'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['amadeusnext_kundenauswahl'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    'amadeusnext_kundenauswahl',
    // Flexform configuration schema file
    'FILE:EXT:amadeus_next/Configuration/FlexForms/AmdsClientSelection.xml'
);


// Additional TCA fields
$tempContentColumns = [
    'color_scheme' => [
        'exclude' => false,
        'label' => 'LLL:EXT:amadeus_next/Resources/Private/Language/locallang_be.xlf:general.colorscheme.label',
        'description' => 'LLL:EXT:amadeus_next/Resources/Private/Language/locallang_be.xlf:general.colorscheme.description',
        'config' => [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'items' => [
                [
                    'label' => 'LLL:EXT:amadeus_next/Resources/Private/Language/locallang_be.xlf:general.colorscheme.bright',
                    'value' => 'bright',
                ],
                [
                    'label' => 'LLL:EXT:amadeus_next/Resources/Private/Language/locallang_be.xlf:general.colorscheme.auto',
                    'value' => 'auto',
                ],
                [
                    'label' => 'LLL:EXT:amadeus_next/Resources/Private/Language/locallang_be.xlf:general.colorscheme.dark',
                    'value' => 'dark',
                ],
            ],
            'default' => 'auto',
        ],
        'l10n_mode' => 'exclude',
    ],
];

ExtensionManagementUtility::addTCAcolumns(
    'tt_content',
    $tempContentColumns
);

unset($tempContentColumns);

ExtensionManagementUtility::addFieldsToPalette(
    'tt_content',
    'frames',
    '--linebreak--,color_scheme',
    ''
);