<?php

defined( 'ABSPATH' ) || exit;

use HelpGent\App\Http\Middleware\Auth;
use HelpGent\App\Http\Middleware\User;
use HelpGent\App\Http\Middleware\CORS;
use HelpGent\App\Http\Middleware\EnsureIsUserAdmin;
use HelpGent\App\Providers\AgentRoleProvider;
use HelpGent\App\Providers\FormAccessLockProvider;
use HelpGent\App\Providers\AttachmentPermissionProvider;
use HelpGent\App\Providers\BackgroundProcessorServiceProvider;
use HelpGent\App\Providers\BuilderMediaOptimizationProvider;
use HelpGent\App\Providers\MediaProtectionProvider;
use HelpGent\App\Providers\MediaTransferProcessorProvider;
use HelpGent\App\Providers\MediaCleanUpServiceProvider;
use HelpGent\App\Providers\MediaMigrationProcessorProvider;
use HelpGent\App\Providers\AuthServiceProvider;
use HelpGent\App\Providers\EmailNotificationProvider;
use HelpGent\App\Providers\FieldServiceProvider;
use HelpGent\App\Providers\LocalizationServiceProvider;
use HelpGent\App\Providers\EmailThrottleServiceProvider;
use HelpGent\App\Providers\FormShareRouteProvider;
use HelpGent\App\Providers\QuizServiceProvider;
use HelpGent\App\Providers\ShortCodeServiceProvider;
use HelpGent\App\Providers\ChatBubbleServiceProvider;
use HelpGent\App\Providers\ChatMemberProvider;
use HelpGent\App\Providers\FontFamilyServiceProvider;
use HelpGent\App\Providers\GuestUserMigrationServiceProvider;
use HelpGent\App\Providers\UserServiceProvider;
use HelpGent\App\Providers\ConversationUsageTrackerProvider;
use HelpGent\App\Providers\Admin\UserServiceProvider as AdminUserServiceProvider;
use HelpGent\App\Providers\Admin\MigrationNoticeServiceProvider;
use HelpGent\App\Providers\Admin\MediaServiceProvider;
use HelpGent\App\Providers\Admin\MediaProtectionNoticeProvider;
use HelpGent\App\Providers\Admin\UserDashboardPageProvider;
use HelpGent\App\Providers\ResponseMetaDataProvider;
use HelpGent\App\Providers\Admin\MenuServiceProvider;
use HelpGent\App\Setup\Activation;
use HelpGent\Database\Migrations\AddQuizPointsToElementAnswers;
use HelpGent\Database\Migrations\AddEntryStarredToResponses;
use HelpGent\Database\Migrations\V224\Migration as V224Migration;
use HelpGent\Database\Migrations\HasOneAnswer;
use HelpGent\Database\Migrations\AttachmentTransferQueue;
use HelpGent\WpMVC\Helpers\Helpers;

return [
    'version'                     => Helpers::get_plugin_version( 'helpgent' ),

    'rest_api'                    => [
        'namespace' => 'helpgent',
        'versions'  => []
    ],

    'ajax_api'                    => [
        'namespace' => 'helpgent',
        'versions'  => []
    ],

    'providers'                   => [
        AgentRoleProvider::class,
        FormAccessLockProvider::class,
        AttachmentPermissionProvider::class,
        MigrationNoticeServiceProvider::class,
        LocalizationServiceProvider::class,
        MediaProtectionProvider::class,
        FormShareRouteProvider::class,
        EmailNotificationProvider::class,
        MediaTransferProcessorProvider::class,
        MediaCleanUpServiceProvider::class,
        MediaMigrationProcessorProvider::class,
        ShortCodeServiceProvider::class,
        ChatBubbleServiceProvider::class,
        ChatMemberProvider::class,
        AuthServiceProvider::class,
        EmailThrottleServiceProvider::class,
        BackgroundProcessorServiceProvider::class,
        BuilderMediaOptimizationProvider::class,
        FontFamilyServiceProvider::class,
        UserServiceProvider::class,
        ConversationUsageTrackerProvider::class,
        // GuestUserMigrationServiceProvider::class,
        FieldServiceProvider::class,
        QuizServiceProvider::class,
        ResponseMetaDataProvider::class,
    ],

    'admin_providers'             => [
        MenuServiceProvider::class,
        MediaProtectionNoticeProvider::class,
        UserDashboardPageProvider::class,
        MediaServiceProvider::class,
        AdminUserServiceProvider::class
    ],

    'middleware'                  => [
        'admin' => EnsureIsUserAdmin::class,
        'auth'  => Auth::class,
        'user'  => User::class,
        'cors'  => CORS::class
    ],

    'migration_db_option_key'     => 'helpgent_migrations',

    'migrations'                  => [
        '1.0.0'             => Activation::class,
        '2.2.4'             => V224Migration::class,
        '2.3.0-quiz-points' => AddQuizPointsToElementAnswers::class,
        '3.0.0-entries-starred' => AddEntryStarredToResponses::class,
        // '2.0.2' => HasOneAnswer::class,
        // '2.0.5' => AttachmentTransferQueue::class,
    ],

    'rest_permission_filter_hook' => 'helpgent_rest_apis_permission'
];
