imports:
    - { resource: tables.yml }

services:
    phpbb.pages.admin.controller:
        class: phpbb\pages\controller\admin_controller
        arguments:
            - '@cache.driver'
            - '@controller.helper'
            - '@language'
            - '@log'
            - '@phpbb.pages.operator'
            - '@request'
            - '@template'
            - '@user'
            - '@service_container'
            - '@dispatcher'
            - '%core.root_path%'
            - '%core.php_ext%'

    phpbb.pages.controller:
        class: phpbb\pages\controller\main_controller
        arguments:
            - '@auth'
            - '@service_container'
            - '@controller.helper'
            - '@language'
            - '@template'
            - '@user'

    phpbb.pages.listener:
        class: phpbb\pages\event\listener
        arguments:
            - '@auth'
            - '@controller.helper'
            - '@language'
            - '@phpbb.pages.operator'
            - '@template'
            - '@user'
            - '%core.php_ext%'
        tags:
            - { name: event.listener }

    phpbb.pages.entity:
        class: phpbb\pages\entity\page
        shared: false # service MUST not be shared for this to work!
        arguments:
            - '@dbal.conn'
            - '@config'
            - '@dispatcher'
            - '%phpbb.pages.tables.pages%'
            - '@text_formatter.utils'

    phpbb.pages.operator:
        class: phpbb\pages\operators\page
        arguments:
            - '@cache.driver'
            - '@service_container'
            - '@dbal.conn'
            - '@ext.manager'
            - '@user'
            - '%phpbb.pages.tables.pages%'
            - '%phpbb.pages.tables.pages_links%'
            - '%phpbb.pages.tables.pages_pages_links%'

    phpbb.pages.routing.loader:
        class: phpbb\pages\routing\page_loader
        arguments:
            - '@dbal.conn'
            - '%phpbb.pages.tables.pages%'
        tags:
            - { name: routing.loader }

    phpbb.pages.text_reparser.page_text:
        class: phpbb\pages\textreparser\plugins\pages_text
        arguments:
            - '@dbal.conn'
            - '%phpbb.pages.tables.pages%'
        calls:
            - [set_name, [phpbb_pages_text]]
        tags:
            - { name: text_reparser.plugin }

    phpbb.pages.cron.task.text_reparser:
        class: phpbb\cron\task\text_reparser\reparser
        arguments:
            - '@config'
            - '@config_text'
            - '@text_reparser.lock'
            - '@text_reparser.manager'
            - '@text_reparser_collection'
        calls:
            - [set_name, [cron.task.text_reparser.phpbb_pages]]
            - [set_reparser, [phpbb.pages.text_reparser.page_text]]
        tags:
            - { name: cron.task }
