parameters:
    app_env: '%env(resolve:APP_ENV)%'
    app_secret: '%env(resolve:APP_SECRET)%'
    app_name: '%env(resolve:APP_NAME)%'
    protocole: '%env(resolve:PROTOCOLE)%'

    database_url: '%env(resolve:DATABASE_URL)%'
    database_name: '%env(resolve:DATABASE_NAME)%'
    database_user: '%env(resolve:DATABASE_USER)%'
    database_password: '%env(resolve:DATABASE_PASSWORD)%'
    database_host: '%env(resolve:DATABASE_HOST)%'

    messenger_transport_dsn: '%env(resolve:MESSENGER_TRANSPORT_DSN)%'

    masteridentity: '%env(resolve:MASTERIDENTITY)%'

    mode_auth: '%env(resolve:MODE_AUTH)%'

    moderegistration: '%env(resolve:MODEREGISTRATION)%'
    keyterm: '%env(resolve:KEYTERM)%'
    minpassword: '%env(resolve:MINPASSWORD)%'
    initpwdadmin: '%env(resolve:INITPWDADMIN)%'

    force_theme: '%env(resolve:FORCE_THEME)%'
    force_themename: '%env(resolve:FORCE_THEMENAME)%'

    cron_activate: '%env(resolve:CRON_ACTIVATE)%'
    syncenvole_activate: '%env(resolve:SYNCENVOLE_ACTIVATE)%'
    websocket_activate: '%env(resolve:WEBSOCKET_ACTIVATE)%'
    portal_activate: '%env(resolve:PORTAL_ACTIVATE)%'
    module_activate: '%env(resolve:MODULE_ACTIVATE)%'
    page_activate: '%env(resolve:PAGE_ACTIVATE)%'
    item_activate: '%env(resolve:ITEM_ACTIVATE)%'
    alert_activate: '%env(resolve:ALERT_ACTIVATE)%'
    calendar_activate: '%env(resolve:CALENDAR_ACTIVATE)%'
    blog_activate: '%env(resolve:BLOG_ACTIVATE)%'
    project_activate: '%env(resolve:PROJECT_ACTIVATE)%'
    flux_activate: '%env(resolve:FLUX_ACTIVATE)%'
    notice_activate: '%env(resolve:NOTICE_ACTIVATE)%'

    ldap_type: '%env(resolve:LDAP_TYPE)%'
    ldap_host: '%env(resolve:LDAP_HOST)%'
    ldap_port: '%env(resolve:LDAP_PORT)%'
    ldap_tls: '%env(resolve:LDAP_TLS)%'
    ldap_user: '%env(resolve:LDAP_USER)%'
    ldap_password: '%env(resolve:LDAP_PASSWORD)%'
    ldap_basedn: '%env(resolve:LDAP_BASEDN)%'
    ldap_addomainehome: '%env(resolve:LDAP_ADDOMAINEHOME)%'
    ldap_addomaineprofil: '%env(resolve:LDAP_ADDOMAINEPROFIL)%'

    weburl: '%env(resolve:WEBURL)%'
    alias: '%env(resolve:ALIAS)%'
    libelle_etab: '%env(resolve:LIBELLE_ETAB)%'
    numero_etab: '%env(resolve:NUMERO_ETAB)%'
    colormain: '%env(resolve:COLORMAIN)%'
    fontcolorhover: '%env(resolve:FONTCOLORHOVER)%'
    labelniveau01: '%env(resolve:LABELNIVEAU01)%'
    labelsniveau01: '%env(resolve:LABELSNIVEAU01)%'
    iconniveau01: '%env(resolve:ICONNIVEAU01)%'
    labelsirenniveau01: '%env(resolve:LABELSIRENNIVEAU01)%'
    viewniveau02: '%env(resolve:VIEWNIVEAU02)%'
    labelniveau02: '%env(resolve:LABELNIVEAU02)%'
    labelsniveau02: '%env(resolve:LABELSNIVEAU02)%'
    iconniveau02: '%env(resolve:ICONNIVEAU02)%'
    labelsiretniveau02: '%env(resolve:LABELSIRETNIVEAU02)%'

    ldap_sync: '%env(resolve:LDAP_SYNC)%'
    ldap_baseuser: '%env(resolve:LDAP_BASEUSER)%'
    ldap_baseniveau01: '%env(resolve:LDAP_BASENIVEAU01)%'
    ldap_baseniveau02: '%env(resolve:LDAP_BASENIVEAU02)%'
    ldap_basegroup: '%env(resolve:LDAP_BASEGROUP)%'
    ldap_template: '%env(resolve:LDAP_TEMPLATE)%'
    ldap_username: '%env(resolve:LDAP_USERNAME)%'
    ldap_firstname: '%env(resolve:LDAP_FIRSTNAME)%'
    ldap_lastname: '%env(resolve:LDAP_LASTNAME)%'
    ldap_email: '%env(resolve:LDAP_EMAIL)%'
    ldap_member: '%env(resolve:LDAP_MEMBER)%'
    ldap_usersadmin: '%env(json:LDAP_USERSADMIN)%'
    scribe_group: '%env(resolve:SCRIBE_GROUP)%'
    scribe_master: '%env(resolve:SCRIBE_MASTER)%'
    openldapreqniveau01: '%env(resolve:OPENLDAPREQNIVEAU01)%'
    openldapsynchrogroup: '%env(resolve:OPENLDAPSYNCHROGROUP)%'
    openldapreqgroup: '%env(resolve:OPENLDAPREQGROUP)%'

    activate_widadminer: '%env(resolve:ACTIVATE_WIDADMINER)%'
    widadminer_url: '%env(resolve:WIDADMINER_URL)%'

    activate_widbalado: '%env(resolve:ACTIVATE_WIDBALADO)%'
    widbalado_url: '%env(resolve:WIDBALADO_URL)%'
    widbalado_activate_syncenvole: '%env(resolve:WIDBALADO_ACTIVATE_SYNCENVOLE)%'
    widbalado_syncenvole: '%env(resolve:WIDBALADO_SYNCENVOLE)%'

    activate_widcdt: '%env(resolve:ACTIVATE_WIDCDT)%'
    widcdt_url: '%env(resolve:WIDCDT_URL)%'
    widcdt_activate_syncenvole: '%env(resolve:WIDCDT_ACTIVATE_SYNCENVOLE)%'
    widcdt_syncenvole: '%env(resolve:WIDCDT_SYNCENVOLE)%'

    activate_widdokuwiki: '%env(resolve:ACTIVATE_WIDDOKUWIKI)%'
    widdokuwiki_url: '%env(resolve:WIDDOKUWIKI_URL)%'

    activate_wideconnect: '%env(resolve:ACTIVATE_WIDECONNECT)%'
    wideconnect_url: '%env(resolve:WIDECONNECT_URL)%'

    activate_widead: '%env(resolve:ACTIVATE_WIDEAD)%'
    widead_url: '%env(resolve:WIDEAD_URL)%'

    activate_wideoe: '%env(resolve:ACTIVATE_WIDEOE)%'
    wideoe_url: '%env(resolve:WIDEOE_URL)%'

    activate_wideop: '%env(resolve:ACTIVATE_WIDEOP)%'
    wideop_url: '%env(resolve:WIDEOP_URL)%'

    activate_widetherhome: '%env(resolve:ACTIVATE_WIDETHERHOME)%'
    widetherhome_url: '%env(resolve:WIDETHERHOME_URL)%'

    activate_widfluxbb: '%env(resolve:ACTIVATE_WIDFLUXBB)%'
    widfluxbb_url: '%env(resolve:WIDFLUXBB_URL)%'

    activate_widgenconfig: '%env(resolve:ACTIVATE_WIDGENCONFIG)%'
    widgenconfig_url: '%env(resolve:WIDGENCONFIG_URL)%'

    activate_widgepi: '%env(resolve:ACTIVATE_WIDGEPI)%'
    widgepi_url: '%env(resolve:WIDGEPI_URL)%'
    widgepi_activate_syncenvole: '%env(resolve:WIDGEPI_ACTIVATE_SYNCENVOLE)%'
    widgepi_syncenvole: '%env(resolve:WIDGEPI_SYNCENVOLE)%'

    activate_widglpi: '%env(resolve:ACTIVATE_WIDGLPI)%'
    widglpi_url: '%env(resolve:WIDGLPI_URL)%'

    activate_widgrr: '%env(resolve:ACTIVATE_WIDGRR)%'
    widgrr_url: '%env(resolve:WIDGRR_URL)%'

    activate_widkanboard: '%env(resolve:ACTIVATE_WIDKANBOARD)%'
    widkanboard_url: '%env(resolve:WIDKANBOARD_URL)%'

    activate_widlimesurvey: '%env(resolve:ACTIVATE_WIDLIMESURVEY)%'
    widlimesurvey_url: '%env(resolve:WIDLIMESURVEY_URL)%'
    widlimesurvey_apiuser: '%env(resolve:WIDLIMESURVEY_APIUSER)%'
    widlimesurvey_apikey: '%env(resolve:WIDLIMESURVEY_APIKEY)%'
    widlimesurvey_activate_syncenvole: '%env(resolve:WIDLIMESURVEY_ACTIVATE_SYNCENVOLE)%'
    widlimesurvey_syncenvole: '%env(resolve:WIDLIMESURVEY_SYNCENVOLE)%'

    activate_widmindmaps: '%env(resolve:ACTIVATE_WIDMINDMAPS)%'
    widmindmaps_url: '%env(resolve:WIDMINDMAPS_URL)%'

    activate_widmoodle: '%env(resolve:ACTIVATE_WIDMOODLE)%'
    widmoodle_url: '%env(resolve:WIDMOODLE_URL)%'
    widmoodle_apikey: '%env(resolve:WIDMOODLE_APIKEY)%'
    widmoodle_activate_syncenvole: '%env(resolve:WIDMOODLE_ACTIVATE_SYNCENVOLE)%'
    widmoodle_syncenvole: '%env(resolve:WIDMOODLE_SYNCENVOLE)%'

    activate_widnextcloud: '%env(resolve:ACTIVATE_WIDNEXTCLOUD)%'
    widnextcloud_url: '%env(resolve:WIDNEXTCLOUD_URL)%'
    widnextcloud_activate_syncenvole: '%env(resolve:WIDNEXTCLOUD_ACTIVATE_SYNCENVOLE)%'
    widnextcloud_syncenvole: '%env(resolve:WIDNEXTCLOUD_SYNCENVOLE)%'
    

    activate_widnineboard: '%env(resolve:ACTIVATE_WIDNINEBOARD)%'
    widnineboard_url: '%env(resolve:WIDNINEBOARD_URL)%'

    activate_widnineschool: '%env(resolve:ACTIVATE_WIDNINESCHOOL)%'
    widnineschool_url: '%env(resolve:WIDNINESCHOOL_URL)%'

    activate_widninesurvey: '%env(resolve:ACTIVATE_WIDNINESURVEY)%'
    widninesurvey_url: '%env(resolve:WIDNINESURVEY_URL)%'

    activate_widonlyoffice: '%env(resolve:ACTIVATE_WIDONLYOFFICE)%'
    widonlyoffice_url: '%env(resolve:WIDONLYOFFICE_URL)%'
    widonlyoffice_user: '%env(resolve:WIDONLYOFFICE_USER)%'
    widonlyoffice_password: '%env(resolve:WIDONLYOFFICE_PASSWORD)%'
    widonlyoffice_sync: '%env(resolve:WIDONLYOFFICE_SYNC)%'

    activate_widopensondage: '%env(resolve:ACTIVATE_WIDOPENSONDAGE)%'
    widopensondage_url: '%env(resolve:WIDOPENSONDAGE_URL)%'

    activate_widphpldapadmin: '%env(resolve:ACTIVATE_WIDPHPLDAPADMIN)%'
    widphpldapadmin_url: '%env(resolve:WIDPHPLDAPADMIN_URL)%'

    activate_widpiwigo: '%env(resolve:ACTIVATE_WIDPIWIGO)%'
    widpiwigo_url: '%env(resolve:WIDPIWIGO_URL)%'

    activate_widpiwik: '%env(resolve:ACTIVATE_WIDPIWIK)%'
    widpiwik_url: '%env(resolve:WIDPIWIK_URL)%'
    widpiwik_activate_syncenvole: '%env(resolve:WIDPIWIK_ACTIVATE_SYNCENVOLE)%'
    widpiwik_syncenvole: '%env(resolve:WIDPIWIK_SYNCENVOLE)%'

    activate_widroundcube: '%env(resolve:ACTIVATE_WIDROUNDCUBE)%'
    widroundcube_url: '%env(resolve:WIDROUNDCUBE_URL)%'

    activate_widsacoche: '%env(resolve:ACTIVATE_WIDSACOCHE)%'
    widsacoche_url: '%env(resolve:WIDSACOCHE_URL)%'
    widsacoche_activate_syncenvole: '%env(resolve:WIDSACOCHE_ACTIVATE_SYNCENVOLE)%'
    widsacoche_syncenvole: '%env(resolve:WIDSACOCHE_SYNCENVOLE)%'

    activate_widwordpress: '%env(resolve:ACTIVATE_WIDWORDPRESS)%'
    widwordpress_url: '%env(resolve:WIDWORDPRESS_URL)%'
    widwordpress_activate_syncenvole: '%env(resolve:WIDWORDPRESS_ACTIVATE_SYNCENVOLE)%'
    widwordpress_syncenvole: '%env(resolve:WIDWORDPRESS_SYNCENVOLE)%'

    activate_widsonde: '%env(resolve:ACTIVATE_WIDSONDE)%'
    widsonde_url: '%env(resolve:WIDSONDE_URL)%'

    cas_host: '%env(resolve:CAS_HOST)%'
    cas_path: '%env(resolve:CAS_PATH)%'
    cas_port: '%env(resolve:CAS_PORT)%'
    cas_type: '%env(resolve:CAS_TYPE)%'

    user_attr_cas_username: '%env(resolve:USER_ATTR_CAS_USERNAME)%'
    user_attr_cas_mail: '%env(resolve:USER_ATTR_CAS_MAIL)%'
    user_attr_cas_lastname: '%env(resolve:USER_ATTR_CAS_LASTNAME)%'
    user_attr_cas_firstname: '%env(resolve:USER_ATTR_CAS_FIRSTNAME)%'

    ssosynchrogroup: '%env(resolve:SSOSYNCHROGROUP)%'
    user_attr_cas_group: '%env(resolve:USER_ATTR_CAS_GROUP)%'

    ssosynchroitem: '%env(resolve:SSOSYNCHROITEM)%'
    user_attr_cas_item: '%env(resolve:USER_ATTR_CAS_ITEM)%'

    mailer_dsn: '%env(resolve:MAILER_DSN)%'
    noreply: '%env(resolve:NOREPLY)%'
    active_imapunread: '%env(resolve:ACTIVE_IMAPUNREAD)%'
    imapundread_ip: '%env(resolve:IMAPUNDREAD_IP)%'

    wss_port: '%env(resolve:WSS_PORT)%'
    wss_url: 'wss:/%env(resolve:WEBURL)%/wss%env(resolve:APP_NAME)%'

services:
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

    App\:
        resource: '../src/'
        exclude:
            - '../src/DependencyInjection/'
            - '../src/Entity/'
            - '../src/Kernel.php'

    # Command
    App\Command\CronCommand:
        public: true
        arguments: ['@service_container']

    App\Command\DumpCommand:
        public: true
        arguments: ['@service_container']

    App\Command\GetLimesurveyCommand:
        public: true
        arguments: ['@service_container']

    App\Command\GetMoodleCommand:
        public: true
        arguments: ['@service_container']

    App\Command\InitCommand:
        public: true
        arguments: ['@service_container']

    App\Command\NotifMessageCommand:
        public: true
        arguments: ['@service_container']

    App\Command\OnlyCommand:
        public: true
        arguments: ['@service_container']

    App\Command\PurgeFileCommand:
        public: true
        arguments: ['@service_container']

    App\Command\PurgeRegistrationCommand:
        public: true
        arguments: ['@service_container']

    App\Command\ScriptCommand:
        public: true
        arguments: ['@service_container']

    App\Command\SetPasswordCommand:
        public: true
        arguments: ['@service_container']

    App\Command\StatisticCommand:
        public: true
        arguments: ['@service_container']

    App\Command\SynchroCommand:
        public: true
        arguments: ['@service_container']

    App\Command\SynchroICSCommand:
        public: true
        arguments: ['@service_container']

    App\Command\WebsocketServerCommand:
        public: true
        arguments: ['@service_container']

    # Service
    App\Service\AppSession:
        public: true
        arguments: ["@service_container","@doctrine.orm.entity_manager","@request_stack","@security.token_storage"]
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onDomainParse }        

    App\Service\LdapService:
        public: true
        arguments:
            - "%ldap_host%"
            - "%ldap_port%"
            - "%ldap_tls%"
            - "%ldap_type%"
            - "%ldap_username%"
            - "%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%"]]

    App\Service\MailService:
        public: true
        arguments: ["@mailer", "@twig"]

    App\Service\MessageService:
        public: true
        arguments: ['%wss_port%']               
        
    App\Service\UploadListener:
        public: true
        arguments: ["@doctrine.orm.entity_manager","@security.token_storage","@request_stack","@App\\Service\\MessageService","@service_container"]
        tags:
            - { name: kernel.event_listener, event: oneup_uploader.post_persist, method: onUpload }    
                    
    App\Service\UploadSamename:
        public: true

    # Formtype
    App\Formtype\IconChoiceType:
        public: true
        arguments:
            - "%kernel.project_dir%/public/fonts/fontawesome/fontawesome-icons.json"

    # Event
    App\Event\SyncUser:
        public: true
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
            - "@App\\Service\\LdapService"
            - "%ldap_username%"
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseUser, ["%ldap_baseuser%"]]               

    App\Event\SyncNiveau01:
        public: true
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
            - "@App\\Service\\LdapService"
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseNiveau01, ["%ldap_baseniveau01%"]]

    App\Event\SyncNiveau02:
        public: true
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
            - "@App\\Service\\LdapService"
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseNiveau02, ["%ldap_baseniveau02%"]]

    App\Event\SyncGroup:
        public: true
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
            - "@App\\Service\\LdapService"
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseGroup, ["%ldap_basegroup%"]]

    App\Event\SyncUsergroup:
        public: true
        arguments:
            - "@service_container"
            - "@doctrine.orm.entity_manager"
            - "@App\\Service\\LdapService"
        tags:
            - { name: doctrine.event_subscriber }
        calls:
            - [setBaseGroup, ["%ldap_basegroup%"]]            

    # Websocket
    App\Websocket\MessageHandler:
        public: true
        arguments:
            - "@service_container"