# 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.html#use-parameters-for-application-configuration
parameters:
    confirm_type: '%env(CONFIRM_TYPE)%'
    code_ttl: '%env(CODE_TTL)%'
    from_email: '%env(MAILER_ADDRESS)%'

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/Entity/'
            - '../src/Kernel.php'

    # Сервисы действий
    App\Service\Action\ActionServiceInterface $registerService: '@App\Service\Action\Classes\Register'

    App\Service\Action\ActionServiceInterface $profileService: '@App\Service\Action\Classes\GetProfile'

    App\Service\Action\ActionServiceInterface $deleteProfileService: '@App\Service\Action\Classes\DeleteProfile'

    App\Service\Action\ActionServiceInterface $recoveryProfileService: '@App\Service\Action\Classes\RecoveryProfile'

    App\Service\Action\ActionServiceInterface $checkRegisterService: '@App\Service\Action\Classes\CheckRegisterCode'

    App\Service\Action\ActionServiceInterface $checkRecoveryService: '@App\Service\Action\Classes\CheckRecoveryCode'

    App\Service\Action\ActionServiceInterface $sendRegisterService: '@App\Service\Action\Classes\SendRegisterCode'

    App\Service\Action\ActionServiceInterface $sendPasswordCodeService: '@App\Service\Action\Classes\SendResetPasswordCode'

    App\Service\Action\ActionServiceInterface $resetPasswordCodeService: '@App\Service\Action\Classes\ResetPasswordCode'

    App\Service\Action\ActionServiceInterface $resetPasswordService: '@App\Service\Action\Classes\ResetPassword'

    App\Service\Action\ActionServiceInterface: '@App\Service\Action\Classes\None'


    # Сервисы Dto
    App\Service\Dto\DtoServiceInterface $registerDto: '@App\Service\Dto\Classes\RegisterDto'

    App\Service\Dto\DtoServiceInterface $registerCodeDto: '@App\Service\Dto\Classes\RegisterCodeDto'

    App\Service\Dto\DtoServiceInterface $recoveryCodeDto: '@App\Service\Dto\Classes\RecoveryCodeDto'

    App\Service\Dto\DtoServiceInterface $passwordResetDto: '@App\Service\Dto\Classes\ResetPasswordCodeDto'

    App\Service\Dto\DtoServiceInterface $passwordDto: '@App\Service\Dto\Classes\ChangePasswordDto'

    App\Service\Dto\DtoServiceInterface $recoveryDto: '@App\Service\Dto\Classes\RecoveryDto'

    App\Service\Dto\DtoServiceInterface: '@App\Service\Dto\Classes\NoneDto'


    # Сервисы ответа
    App\Service\Response\ResponseServiceInterface $profileResponse: '@App\Service\Response\Classes\ProfileResponse'

    App\Service\Response\ResponseServiceInterface: '@App\Service\Response\Classes\Response'


    # Сервис отправки
    App\Service\Send\SendService:
        arguments:
            $confirmType: '%confirm_type%'
            $fromEmail: '%from_email%'

    App\Service\Send\SendServiceInterface $codeSendService: '@App\Service\Send\Classes\CodeSendService'

    App\Service\Send\SendServiceInterface $registerCodeSendService: '@App\Service\Send\Classes\Code\RegisterCodeSendService'

    App\Service\Send\SendServiceInterface $recoveryCodeSendService: '@App\Service\Send\Classes\Code\RecoveryCodeSendService'

    App\Service\Send\SendServiceInterface $passwordCodeSendService: '@App\Service\Send\Classes\Code\PasswordCodeSendService'

    # События JWT авторизации
    acme_api.event.authentication_success_listener:
        class: App\Listeners\JwtListener
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_authentication_success, method: onAuthenticationSuccessResponse }

    acme_api.event.authentication_failure_listener:
        class: App\Listeners\JwtListener
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_authentication_failure, method: onAuthenticationFailureResponse }

    acme_api.event.jwt_invalid_listener:
        class: App\Listeners\JwtListener
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_jwt_invalid, method: onJWTInvalid }

    acme_api.event.jwt_notfound_listener:
        class: App\Listeners\JwtListener
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_jwt_not_found, method: onJWTNotFound }

    acme_api.event.jwt_expired_listener:
        class: App\Listeners\JwtListener
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_jwt_expired, method: onJWTExpired }