# 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:

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.
        public: false

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

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

    # Repositories
    App\Course\Domain\Repository\CourseRepositoryInterface:
        class: App\Course\Infrastructure\Persistence\Doctrine\Repository\DoctrineCourseRepository

    App\Course\Domain\Repository\TeachingUnitRepositoryInterface:
        class: App\Course\Infrastructure\Persistence\Doctrine\Repository\DoctrineTeachingUnitRepository

    App\Course\Domain\Repository\SemesterRepositoryInterface:
        class: App\Course\Infrastructure\Repository\SemesterRepository

    App\Grade\Domain\Repository\GradeRepositoryInterface:
        class: App\Grade\Infrastructure\Persistence\Doctrine\Repository\DoctrineGradeRepository

    # Controllers
    App\Core\Security\Controller\:
        resource: '../src/Core/Security/Controller/'
        tags: ['controller.service_arguments']

    App\Admin\Controller\:
        resource: '../src/Admin/Controller/'
        tags: ['controller.service_arguments']

    # Command Handlers
    App\Course\Application\Command\CreateCourse\CreateCourseHandler:
        tags: ['messenger.message_handler']
        arguments:
            $courseRepository: '@App\Course\Domain\Repository\CourseRepositoryInterface'
            $teachingUnitRepository: '@App\Course\Domain\Repository\TeachingUnitRepositoryInterface'

    # Security Services
    App\Core\Security\Authorization\Voter\RoleVoter:
        tags:
            - { name: 'security.voter' }

    App\Core\Security\Authorization\AuthorizationChecker:
        arguments:
            $authorizationChecker: '@security.authorization_checker'

    App\Core\Domain\Repository\UserRepositoryInterface:
        class: App\Core\Infrastructure\Persistence\Doctrine\Repository\DoctrineUserRepository

    App\Core\Domain\Repository\StudentRepositoryInterface:
        class: App\Core\Infrastructure\Repository\StudentRepository

    App\Core\Domain\Repository\TeacherRepositoryInterface:
        class: App\Core\Infrastructure\Repository\TeacherRepository

    App\Core\Domain\Repository\DepartmentRepositoryInterface:
        class: App\Core\Infrastructure\Repository\DepartmentRepository

    App\Core\Domain\Repository\LevelRepositoryInterface:
        class: App\Core\Infrastructure\Repository\LevelRepository
