<?php
/**
 * @package   Essentials YOOtheme Pro 2.2.16 build 0813.1608
 * @author    ZOOlanders https://www.zoolanders.com
 * @copyright Copyright (C) Joolanders, SL
 * @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
 */

namespace ZOOlanders\YOOessentials\Source;

use YOOtheme\Builder\BuilderConfig;
use YOOtheme\Builder\Source\SourceTransform;
use ZOOlanders\YOOessentials\Config\ConfigUpdater;
use ZOOlanders\YOOessentials\UpdateTransform;

return [
    'config' => [
        BuilderConfig::class => __DIR__ . '/config/builder.json',
    ],

    'routes' => [
        ['post', SourceController::REBUILD_SCHEMA_URL, SourceController::class . '@rebuildSchema'],
    ],

    'events' => [
        'source.init' => [
            Listener\RegisterSources::class => ['@handle', 60],
        ],

        'customizer.init' => [
            Listener\LoadCustomizerData::class => ['@handle', -10],
        ],

        'yooessentials.config.load' => [
            Listener\ValidateSources::class => ['@load'],
        ],
    ],

    'loaders' => [
        'yooessentials-sources' => new SourceLoader(),
    ],

    'extend' => [
        SourceTransform::class => function (SourceTransform $transform) {
            $transform->addFilter('time', [SourceFilter::class, 'applyTime'], -10);
            $transform->addFilter('datemodify', [SourceFilter::class, 'applyDatemodify'], -10);
        },

        ConfigUpdater::class => function (ConfigUpdater $updater) {
            $updater->addGlobals(require __DIR__ . '/updates.php');
        },

        UpdateTransform::class => function (UpdateTransform $update) {
            $update->addGlobals(require __DIR__ . '/updates.php');
        },
    ],

    'services' => [
        SourceService::class => '',
    ],

    'yooessentials-bootstrap' => [
        __DIR__ . '/providers/AcyMailing/bootstrap.php',
        __DIR__ . '/providers/Airtable/bootstrap.php',
        __DIR__ . '/providers/Csv/bootstrap.php',
        __DIR__ . '/providers/Database/bootstrap.php',
        __DIR__ . '/providers/Rss/bootstrap.php',
        __DIR__ . '/providers/Facebook/bootstrap.php',
        __DIR__ . '/providers/GoogleSheet/bootstrap.php',
        __DIR__ . '/providers/GoogleCalendar/bootstrap.php',
        __DIR__ . '/providers/GooglePhotos/bootstrap.php',
        __DIR__ . '/providers/GoogleBusinessProfile/bootstrap.php',
        __DIR__ . '/providers/YouTube/bootstrap.php',
        __DIR__ . '/providers/Instagram/bootstrap.php',
        __DIR__ . '/providers/Twitter/bootstrap.php',
        __DIR__ . '/providers/TikTok/bootstrap.php',
        __DIR__ . '/providers/Vimeo/bootstrap.php',
        __DIR__ . '/providers/Rss/bootstrap.php',
        __DIR__ . '/providers/Xml/bootstrap.php',
        __DIR__ . '/providers/CloudflareStream/bootstrap.php',
        __DIR__ . '/providers/Request/bootstrap.php',
    ],
];
