services:
    Cadoles\CoreBundle\Command\InitDataCommand:
      tags:
        - { name: 'console.command', command: 'Core:InitData' }    
        
    Cadoles\CoreBundle\Command\OnlyCommand:
      tags:
        - { name: 'console.command', command: 'Core:Only' }    

    Cadoles\CoreBundle\Command\PurgeFileCommand:
      tags:
        - { name: 'console.command', command: 'Core:PurgeFile' }          

    Cadoles\CoreBundle\Command\PurgeRegistrationCommand:
      tags:
        - { name: 'console.command', command: 'Core:PurgeRegistration' }   

    Cadoles\CoreBundle\Command\SetPasswordCommand:
      tags:
        - { name: 'console.command', command: 'Core:SetPassword' }        

    Cadoles\CoreBundle\Command\SynchroCommand:
      tags:
        - { name: 'console.command', command: 'Core:Synchro' }   

    cadoles.core.session.listener:
        public: true
        class: Cadoles\CoreBundle\EventListener\sessionListener
        arguments: ['@service_container','@doctrine.orm.entity_manager',"@security.token_storage","@session"]
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onDomainParse }

    cadoles.core.upload.listener:
        public: true
        class: Cadoles\CoreBundle\EventListener\uploadListener
        arguments: ["@doctrine.orm.entity_manager","@security.token_storage","@session","@service_container"]
        tags:
            - { name: kernel.event_listener, event: oneup_uploader.post_persist, method: onUpload }

    cadoles.core.upload.namer.same:
        public: true
        class: Cadoles\CoreBundle\Service\uploadSameNamer

    cadoles.core.password.encoder:
        public: true
        class: Cadoles\CoreBundle\Service\passwordEncoder

    cadoles.core.sync.user:
        public: true
        class: Cadoles\CoreBundle\EventListener\syncUser
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
            - %ldap_username%
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseUser, ["%ldap_baseuser%"]]

    cadoles.core.sync.niveau01:
        public: true
        class: Cadoles\CoreBundle\EventListener\syncNiveau01
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseNiveau01, ["%ldap_baseNiveau01%"]]

    cadoles.core.sync.niveau02:
        public: true
        class: Cadoles\CoreBundle\EventListener\syncNiveau02
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseNiveau02, ["%ldap_baseniveau02%"]]

    cadoles.core.sync.group:
        public: true
        class: Cadoles\CoreBundle\EventListener\syncGroup
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseGroup, ["%ldap_basegroup%"]]

    cadoles.core.sync.usergroup:
        public: true
        class: Cadoles\CoreBundle\EventListener\syncUserGroup
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseGroup, ["%ldap_basegroup%"]]

    cadoles.core.service.ldap:
        public: true
        class: Cadoles\CoreBundle\Service\ldapService
        arguments:
            - %ldap_host%
            - %ldap_port%
            - %ldap_tls%
            - %ldap_type%
            - %ldap_addomainehome%
            - %ldap_addomaineprofil%
        calls:
            - [setUser, ["%ldap_user%"]]
            - [setPassword, ["%ldap_password%"]]
            - [setBaseDN, ["%ldap_basedn%"]]
            - [setBaseUser, ["%ldap_baseuser%"]]
            - [setBaseNiveau01, ["%ldap_baseniveau01%"]]
            - [setBaseNiveau02, ["%ldap_baseniveau02%"]]
            - [setBaseGroup, ["%ldap_basegroup%"]]
            - [setLdapSync, ["%ldap_sync%","%masteridentity%"]]

    cadoles.core.service.only:
        public: true
        class: Cadoles\CoreBundle\Service\onlyService
        arguments: ['@service_container','@doctrine.orm.entity_manager']

    cadoles.core.service.mail:
        public: true
        class:     Cadoles\CoreBundle\Service\mailService
        arguments: ["@mailer", "@twig"]

    cadoles.core.service.color:
        public: true
        class: Cadoles\CoreBundle\Service\colorService
        arguments: ['@service_container']

    cadoles.core.icon_choice_type:
        public: true
        class: Cadoles\CoreBundle\Form\IconChoiceType
        arguments: ["%kernel.root_dir%/../web/bundles/cadolescore/css/font-awesome.css"]
        tags:
            - { name: form.type }

    cadoles.saml_user_mapper:
        public: true
        class: Cadoles\CoreBundle\Service\samlUserMapperService
        arguments:
            - "@=service('doctrine').getManager()"
            - "@service_container"
            - "@session"

    cadoles.saml_user_creator:
        public: true
        class: Cadoles\CoreBundle\Service\samlUserCreatorService
        arguments:
            - "@=service('doctrine').getManager()"
            - "@service_container"
            - "@session"        

    cadoles.saml_attribute_mapper:
        public: true
        class: Cadoles\CoreBundle\Service\samlAttributeMapperService

    cadoles.form.icon_choice_type:
        class: Cadoles\CoreBundle\Form\Type\IconChoiceType

        arguments:
            # Liste des icones FontAwesome au format JSON
            # Récupéré depuis le dépôt officiel via la commande "make fetch-fontawesome-icons"
            # Voir Makefile du MSE
            - "%kernel.root_dir%/../web/fonts/fontawesome/fontawesome-icons.json"
        tags:
            - { name: form.type }



           