# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    file.upload_dir: '%kernel.project_dir%/public/uploads/'
    file.report_dir: '%kernel.project_dir%/public/reports/'

services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

    # makes classes in src/ available to be used as services
    # this creates a service per class whose id is the fully-qualified class name
    App\:
        resource: '../src/'
        exclude:
            - '../src/DependencyInjection/'
            - '../src/Kernel.php'
            - '../src/Tests/'

    # controllers are imported separately to make sure services can be injected
    # as action arguments even if you don't extend any base controller class
    App\Controller\:
        resource: '../src/Controller/'
        tags: ['controller.service_arguments']

    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones

    App\Core\EventListener\ExceptionListener:
        tags:
            - { name: kernel.event_listener, event: kernel.exception }

    app.json_param_converter:
        class: App\Core\ParamConverter\JsonDeserializeParamConverter
        tags:
            - { name: 'request.param_converter', converter: 'json_deserialize_param_converter' }

    app.form_data_param_converter:
        class: App\Core\ParamConverter\FormDataDeserializeParamConverter
        tags:
            - { name: 'request.param_converter', converter: 'form_data_deserialize_param_converter' }

    App\Core\File\FileUploader\FileUploader:
        arguments:
            $fileUploadDir: '%file.upload_dir%'

    App\Core\File\FileRemover\FileRemover:
        arguments:
            $fileUploadDir: '%file.upload_dir%'

    App\PaymentSystem\Przelewy24:
        bind:
            $crc: '%env(P24_CRC)%'
            $merchantId: '%env(P24_MERCHANT_ID)%'
            $apiKey: '%env(P24_API_KEY)%'
#            for production p24 service
            $isLiveMode: '%env(LIVE_MODE)%'

    App\Core\UrlGenerator\CustomUrlGenerator:
        bind:
            $frontendUrl: '%env(FRONTEND_URL)%'
            $env: '%env(APP_ENV)%'

    App\Core\UrlGenerator\Orders\OrderUrlGenerator:
      bind:
        $frontendUrl: '%env(FRONTEND_URL)%'
        $env: '%env(APP_ENV)%'

    App\Core\UrlGenerator\Reports\ReportUrlGenerator:
      bind:
        $frontendUrl: '%env(FRONTEND_URL)%'
        $env: '%env(APP_ENV)%'

    App\Core\EventListener\LogoutListener:
        tags:
            - name: 'kernel.event_listener'
              event: 'Symfony\Component\Security\Http\Event\LogoutEvent'
              dispatcher: security.event_dispatcher.main
              method: 'onLogoutEvent'

    App\Services\Reports\GenerateAnnualReportPDF:
        bind:
            $filePath: '%file.report_dir%'