<?php

declare(strict_types=1);

namespace App;

/**
 * The configuration provider for the App module
 *
 * @see https://docs.zendframework.com/zend-component-installer/
 */
class ConfigProvider
{
    /**
     * Returns the configuration array
     *
     * To add a bit of a structure, each section is defined in a separate
     * method which returns an array with its configuration.
     *
     */
    public function __invoke() : array
    {
        return [
            'dependencies' => $this->getDependencies(),
            'templates'    => $this->getTemplates(),
        ];
    }

    /**
     * Returns the container dependencies
     */
    public function getDependencies() : array
    {
        return [
            'invokables' => [
                Handler\PingHandler::class => Handler\PingHandler::class,

                Service\JudgeManager::class => Service\JudgeManager::class,
            ],
            'factories'  => [
                Handler\HomePageHandler::class => Handler\HomePageHandlerFactory::class,
                Handler\ArticleHandler::class => Handler\ArticleHandlerFactory::class,
                Handler\AwardeeHandler::class => Handler\AwardeeHandlerFactory::class,
                Handler\JudgesHandler::class => Handler\JudgesHandlerFactory::class,
                Handler\ProfileHandler::class => Handler\ProfileHandlerFactory::class,

                Handler\AwardeeRedirectHandler::class => Handler\AwardeeRedirectHandlerFactory::class,
                Handler\PrizeRedirectHandler::class => Handler\PrizeRedirectHandlerFactory::class,

                Plates\StringExtension::class => Plates\StringExtensionFactory::class,
                Plates\NavigationExtension::class => Plates\NavigationExtensionFactory::class,
                Service\AwardeeManager::class => Service\AwardeeManagerFactory::class,
            ],
        ];
    }

    /**
     * Returns the templates configuration
     */
    public function getTemplates() : array
    {
        return [
            'paths' => [
                'app'    => ['templates/app'],
                'error'  => ['templates/error'],
                'layout' => ['templates/layout'],
            ],
        ];
    }
}
