# 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:
    exam_papers_directory: '%kernel.project_dir%/var/storage/past_questions'
#    exam_papers_directory: '%kernel.project_dir%/public/uploads/exam_papers'
    profile_picture_directory: '%kernel.project_dir%/public/uploads/profile_picture/'
    signature_directory: '%kernel.project_dir%/public/uploads/signature/'
    long_essay_files_directory: '%kernel.project_dir%/public/uploads/long_essay_claims_files/'
    teaching_claims_files_directory: '%kernel.project_dir%/public/uploads/teaching_claims_files_directory/'
    marking_files_directory: '%kernel.project_dir%/public/uploads/marking_files/'
    moderation_files_directory: '%kernel.project_dir%/public/uploads/moderation_files/'
    id_cards_directory: '%kernel.project_dir%/public/uploads/id_cards/'
    database_backup_directory: '%kernel.project_dir%/public/uploads/db_backup/'
    company_documents_directory: '%kernel.project_dir%/public/uploads/company_documents/'
    welfare_docs_directory: '%kernel.project_dir%/public/uploads/welfare/'
    sms_api_key: '%env(SMS_API_KEY)%'

services:

                
    App\EventListener\LoginSuccessListener:
        arguments: ['@router']
        tags:
            - { name: kernel.event_listener, event: security.interactive_login, method: 'onSecurityInteractiveLogin' }   
    # default configuration for services in *this* file
    Sonata\UserBundle\Model\UserManagerInterface: '@sonata.user.manager.user'
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
        bind:
            $smsApiKey: '%env(SMS_API_KEY)%'
            $paystackSecretKey: '%env(PAYSTACK_SECRET_KEY)%'
            $uploadDirectory: '%kernel.project_dir%/public/uploads/exam_papers'
    # Explicitly map the argument name to the parameter
    App\Service\SenderIdService: ~
    
    App\Service\PaystackService:
        arguments:
            $paystackSecretKey: '%env(PAYSTACK_SECRET_KEY)%'
         
#    App\Service\ExamPaperImporter:
#        arguments:
#            # Re-uses the exact same parameter string configured for your admin panel
#            $uploadDirectory: '%kernel.project_dir%/public/uploads/exam_papers'    
            
    App\Service\RemoteDataFetcher:
        class: App\Service\RemoteDataFetcher
        # This tells Symfony to inject the specific DBAL connection service ID 
        # (doctrine.dbal.secondary_connection) into the constructor argument.
#        arguments:
#            $remoteConnection: '@doctrine.dbal.secondary_connection'
    # 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\NotificationHandler:
        arguments:
#            $mailer: '@mailer'
            $twig: '@twig'
    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones

    # ...
#    App\Service\MtnMobileMoneyService:
#        arguments:
#            $logger: '@logger' # Inject the logger service
#
#    App\Service\PayoutProcessorService:
#        arguments:
#            $accountId: '%env(ACCOUNT_ID)%'
#            $paymentToken: '%env(PAYMENT_TOKEN)%'
#            $paymentRefreshToken: '%env(PAYMENT_REFRESHTOKEN)%'
#            
#    App\Service\PaymentApiService:
#        arguments:
#            $accountId: '%env(ACCOUNT_ID)%'
#            $paymentToken: '%env(PAYMENT_TOKEN)%'
#            $paymentRefreshToken: '%env(PAYMENT_REFRESHTOKEN)%'
#            
#
#    App\Service\Welfare\WelfareLinkService:
#        arguments:
#            $appSecret: '%kernel.secret%'
# Customized links

#    change_password_admin_list:
#        class: App\Admin\ChangePasswordAdmin
#
##        arguments:
##            - '@security.token_storage' 
#            
#        tags:
#            - { name: sonata.admin, model_class:  ~, controller: '@App\Controller\ChangePasswordController', manager_type: orm, group: admin, label: Change Password }

#    change_password_admin_list:
#        class: App\Admin\ChangePasswordAdmin
#        arguments:
##            - App\Entity\SonataUserUser
##            - '@App\Controller\ChangePasswordController'
#        tags: 
#            - { name: 'sonata.admin',manager_type: orm,group: "custom",label: Change Password }
#    App\Controller\ChangePasswordController:
#        parent: sonata.admin.controller.crud

    admin.user_management_suite:
            class: App\Admin\UserAdmin
            arguments:
                - '@sonata.user.manager.user'                  # 1st: Inject the Sonata User Manager service object
                - App\Entity\SonataUserUser                    # 2nd: Match your model class parameter tag
                - App\Controller\Admin\UserAdminController     # 3rd: Map your custom action overrides controller    
 

    admin.exam_paper:
        class: App\Admin\ExamPaperAdmin
        tags:
            - { name: sonata.admin, model_class: App\Entity\ExamPaper, controller: App\Controller\ExamPaperImportController, manager_type: orm, group: "Portal Management", label: 'Exam Papers' }
        calls:
            - [setSlugger, ['@slugger']]
            - [setUploadDirectory, ['%exam_papers_directory%']]   
            - [setTokenStorage, ['@security.token_storage']]
            
    App\Block\ExamPaperAnalyticsBlockService:
        arguments:
            $twig: '@twig'
            $paperRepository: '@App\Repository\ExamPaperRepository'
        tags:
            - { name: sonata.block }        
            
    admin.faculty:
            class: App\Admin\FacultyAdmin
            tags:
                - { name: sonata.admin, model_class: App\Entity\Faculty, manager_type: orm, group: "University Hierarchy", label: "Faculties" }

    admin.department:
        class: App\Admin\DepartmentAdmin
        tags:
            - { name: sonata.admin, model_class: App\Entity\Department, manager_type: orm, group: "University Hierarchy", label: "Departments" }

    admin.programme:
        class: App\Admin\ProgrammeAdmin
        tags:
            - { name: sonata.admin, model_class: App\Entity\Programme, manager_type: orm, group: "University Hierarchy", label: "Programmes" }

    admin.course:
        class: App\Admin\CourseAdmin
        tags:
            - { name: sonata.admin, model_class: App\Entity\Course, manager_type: orm, group: "University Hierarchy", label: "Courses" }
            
            
    admin.exam_paper_attachment:
        class: App\Admin\ExamPaperAttachmentAdmin
        tags:
            - { name: sonata.admin, model_class: App\Entity\ExamPaperAttachment, manager_type: orm, group: "Portal Management", show_in_dashboard: false }

    admin.institute:
        class: App\Admin\InstituteAdmin
        tags:
            - { name: sonata.admin, model_class: App\Entity\Institute, controller: ~, manager_type: orm, group: admin, label: Institute }

    admin.exam_paper_import_log:
        class: App\Admin\ExamPaperImportLogAdmin
        tags:
            - { name: sonata.admin, model_class: App\Entity\ExamPaperImportLog, controller: ~, manager_type: orm, group: admin, label: Exam Paper Import Log }
