imports:
    - { resource: tables.yml }
    - { resource: currencies.yml }

services:
    stevotvr.groupsub.listener:
        class: stevotvr\groupsub\event\main_listener
        arguments:
            - '@auth'
            - '@config'
            - '@dbal.conn'
            - '@controller.helper'
            - '@stevotvr.groupsub.operator.package'
            - '@template'
            - '%stevotvr.groupsub.tables.groups%'
            - '%stevotvr.groupsub.tables.subs%'
        tags:
            - { name: event.listener }

    stevotvr.groupsub.cron.task.main:
        class: stevotvr\groupsub\cron\task\main
        arguments:
            - '@config'
            - '@stevotvr.groupsub.operator.subscription'
        calls:
            - method: set_name
              arguments:
                - cron.task.stevotvr.groupsub
        tags:
            - { name: cron.task }

    stevotvr.groupsub.notification.type:
        class: stevotvr\groupsub\notification\type\base_type
        abstract: true
        parent: notification.type.base
        calls:
            - method: setup
              arguments:
                - '@controller.helper'
                - '@user_loader'

    stevotvr.groupsub.notification.type.warn:
        class: stevotvr\groupsub\notification\type\warn
        shared: false
        parent: stevotvr.groupsub.notification.type
        tags:
            - { name: notification.type }

    stevotvr.groupsub.notification.type.expired:
        class: stevotvr\groupsub\notification\type\expired
        shared: false
        parent: stevotvr.groupsub.notification.type
        tags:
            - { name: notification.type }

    stevotvr.groupsub.controller.acp:
        class: stevotvr\groupsub\controller\acp_base_controller
        abstract: true
        arguments:
            - '@config'
            - '@service_container'
            - '@stevotvr.groupsub.operator.currency'
            - '@dbal.conn'
            - '@language'
            - '@request'
            - '@template'

    stevotvr.groupsub.controller.acp.settings:
        class: stevotvr\groupsub\controller\acp_settings_controller
        parent: stevotvr.groupsub.controller.acp
        calls:
            - method: setup
              arguments:
                - '@config_text'

    stevotvr.groupsub.controller.acp.package:
        class: stevotvr\groupsub\controller\acp_pkgs_controller
        parent: stevotvr.groupsub.controller.acp
        calls:
            - method: setup
              arguments:
                - '@stevotvr.groupsub.operator.package'
                - '@stevotvr.groupsub.operator.unit_helper'
                - '%tables.groups%'

    stevotvr.groupsub.controller.acp.subscription:
        class: stevotvr\groupsub\controller\acp_subs_controller
        parent: stevotvr.groupsub.controller.acp
        calls:
            - method: setup
              arguments:
                - '@stevotvr.groupsub.operator.package'
                - '@stevotvr.groupsub.operator.subscription'
                - '@pagination'
                - '@user'
                - '%tables.users%'
            - method: set_path_info
              arguments:
                - '%core.root_path%'
                - '%core.php_ext%'

    stevotvr.groupsub.controller.acp.transaction:
        class: stevotvr\groupsub\controller\acp_trans_controller
        parent: stevotvr.groupsub.controller.acp
        calls:
            - method: setup
              arguments:
                - '@pagination'
                - '@stevotvr.groupsub.operator.transaction'
                - '@user'

    stevotvr.groupsub.controller.ipn:
        class: stevotvr\groupsub\controller\ipn_controller
        arguments:
            - '@config'
            - '@stevotvr.groupsub.operator.http_helper'
            - '@request'
            - '@stevotvr.groupsub.operator.transaction'

    stevotvr.groupsub.controller.main:
        class: stevotvr\groupsub\controller\main_controller
        arguments:
            - '@auth'
            - '@config'
            - '@config_text'
            - '@stevotvr.groupsub.operator.currency'
            - '@controller.helper'
            - '@language'
            - '@stevotvr.groupsub.operator.package'
            - '@request'
            - '@stevotvr.groupsub.operator.subscription'
            - '@template'
            - '@stevotvr.groupsub.operator.unit_helper'
            - '@user'
        calls:
            - method: set_path_info
              arguments:
                - '%core.root_path%'
                - '%core.php_ext%'

    stevotvr.groupsub.controller.return:
        class: stevotvr\groupsub\controller\return_controller
        arguments:
            - '@controller.helper'
            - '@language'
            - '@stevotvr.groupsub.operator.package'
            - '@request'
            - '@template'
            - '@stevotvr.groupsub.operator.unit_helper'

    stevotvr.groupsub.entity:
        class: stevotvr\groupsub\entity\entity
        abstract: true
        arguments:
            - '@dbal.conn'

    stevotvr.groupsub.entity.package:
        class: stevotvr\groupsub\entity\package
        parent: stevotvr.groupsub.entity
        shared: false
        arguments:
            - '%stevotvr.groupsub.tables.packages%'
        calls:
            - method: setup
              arguments:
                - '@config'

    stevotvr.groupsub.entity.term:
        class: stevotvr\groupsub\entity\term
        parent: stevotvr.groupsub.entity
        shared: false
        arguments:
            - '%stevotvr.groupsub.tables.terms%'
        calls:
            - method: setup
              arguments:
                - '%stevotvr.groupsub.currencies%'

    stevotvr.groupsub.entity.subscription:
        class: stevotvr\groupsub\entity\subscription
        parent: stevotvr.groupsub.entity
        shared: false
        arguments:
            - '%stevotvr.groupsub.tables.subs%'

    stevotvr.groupsub.operator:
        class: stevotvr\groupsub\operator\operator
        abstract: true
        arguments:
            - '@config'
            - '@service_container'
            - '@dbal.conn'
            - '@language'
            - '%stevotvr.groupsub.currencies%'
            - '%stevotvr.groupsub.tables.packages%'
            - '%stevotvr.groupsub.tables.groups%'
            - '%stevotvr.groupsub.tables.terms%'
            - '%stevotvr.groupsub.tables.subs%'

    stevotvr.groupsub.operator.package:
        class: stevotvr\groupsub\operator\package
        parent: stevotvr.groupsub.operator

    stevotvr.groupsub.operator.subscription:
        class: stevotvr\groupsub\operator\subscription
        parent: stevotvr.groupsub.operator
        calls:
            - method: setup
              arguments:
                - '@notification_manager'
                - '@dispatcher'
                - '%tables.users%'
            - method: set_path_info
              arguments:
                - '%core.root_path%'
                - '%core.php_ext%'

    stevotvr.groupsub.operator.unit_helper:
        class: stevotvr\groupsub\operator\unit_helper
        parent: stevotvr.groupsub.operator

    stevotvr.groupsub.operator.currency:
        class: stevotvr\groupsub\operator\currency
        parent: stevotvr.groupsub.operator

    stevotvr.groupsub.operator.transaction:
        class: stevotvr\groupsub\operator\transaction
        parent: stevotvr.groupsub.operator
        calls:
            - method: setup
              arguments:
                - '@request'
                - '@stevotvr.groupsub.operator.currency'
                - '@dispatcher'
                - '@stevotvr.groupsub.operator.subscription'
                - '%stevotvr.groupsub.tables.trans%'
                - '%tables.users%'

    stevotvr.groupsub.operator.http_helper:
        class: stevotvr\groupsub\operator\http_helper
        parent: stevotvr.groupsub.operator
