parameters:
    oro_calendar.calendar.entity.class:                          Oro\Bundle\CalendarBundle\Entity\Calendar
    oro_calendar.calendar_event.entity.class:                    Oro\Bundle\CalendarBundle\Entity\CalendarEvent
    oro_calendar.calendar_property.entity.class:                 Oro\Bundle\CalendarBundle\Entity\CalendarProperty
    oro_calendar.system_calendar.entity.class:                   Oro\Bundle\CalendarBundle\Entity\SystemCalendar
    oro_calendar.listener.entity_listener.class:                 Oro\Bundle\CalendarBundle\EventListener\EntityListener
    oro_calendar.listener.datagrid.activity.class:               Oro\Bundle\CalendarBundle\EventListener\Datagrid\ActivityGridListener
    oro_calendar.listener.datagrid.system_calendar.class:        Oro\Bundle\CalendarBundle\EventListener\Datagrid\SystemCalendarGridListener
    oro_calendar.datagrid.helper.calendar_event_grid.class:      Oro\Bundle\CalendarBundle\Datagrid\CalendarEventGridHelper
    oro_calendar.datagrid.action_permission_provider.class:      Oro\Bundle\CalendarBundle\Datagrid\ActionPermissionProvider
    oro_calendar.calendar_event.manager.api.class:               Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager
    oro_calendar.calendar_property.manager.api.class:            Oro\Bundle\CalendarBundle\Manager\CalendarPropertyApiEntityManager
    oro_calendar.system_calendar.manager.api.class:              Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager
    oro_calendar.twig.dateformat.class:                          Oro\Bundle\CalendarBundle\Twig\DateFormatExtension
    oro_calendar.twig.recurrence.class:                          Oro\Bundle\CalendarBundle\Twig\RecurrenceExtension
    oro_calendar.provider.calendar_config.class:                 Oro\Bundle\CalendarBundle\Provider\CalendarDateTimeConfigProvider
    oro_calendar.provider.attendee_email_recipients.class:       Oro\Bundle\CalendarBundle\Provider\AttendeeEmailRecipientsProvider
    oro_calendar.owner_assignment_checker.calendar.class:        Oro\Bundle\CalendarBundle\Ownership\CalendarOwnerAssignmentChecker
    oro_calendar.activity_list.provider.class:                   Oro\Bundle\CalendarBundle\Provider\CalendarEventActivityListProvider
    oro_calendar.calendar_event_manager.class:                   Oro\Bundle\CalendarBundle\Manager\CalendarEventManager
    oro_calendar.calendar_manager.class:                         Oro\Bundle\CalendarBundle\Manager\CalendarManager
    oro_calendar.attendee_manager.class:                         Oro\Bundle\CalendarBundle\Manager\AttendeeManager
    oro_calendar.attendee_relation_manager.class:                Oro\Bundle\CalendarBundle\Manager\AttendeeRelationManager
    oro_calendar.calendar_property_provider.class:               Oro\Bundle\CalendarBundle\Provider\CalendarPropertyProvider
    oro_calendar.calendar_provider.user.class:                   Oro\Bundle\CalendarBundle\Provider\UserCalendarProvider
    oro_calendar.calendar_provider.system.class:                 Oro\Bundle\CalendarBundle\Provider\SystemCalendarProvider
    oro_calendar.calendar_provider.public.class:                 Oro\Bundle\CalendarBundle\Provider\PublicCalendarProvider
    oro_calendar.calendar_event_normalizer.user.class:           Oro\Bundle\CalendarBundle\Provider\UserCalendarEventNormalizer
    oro_calendar.calendar_event_normalizer.system.class:         Oro\Bundle\CalendarBundle\Provider\SystemCalendarEventNormalizer
    oro_calendar.calendar_event_normalizer.public.class:         Oro\Bundle\CalendarBundle\Provider\PublicCalendarEventNormalizer
    oro_calendar.autocomplete.user_calendar_handler.class:       Oro\Bundle\CalendarBundle\Autocomplete\UserCalendarHandler
    oro_calendar.send_processor.email.class:                     Oro\Bundle\CalendarBundle\Model\Email\EmailSendProcessor
    oro_calendar.system_calendar_config.class:                   Oro\Bundle\CalendarBundle\Provider\SystemCalendarConfig
    oro_calendar.event_listener.navigation.class:                Oro\Bundle\CalendarBundle\EventListener\NavigationListener
    oro_calendar.system_calendar.handler.delete.class:           Oro\Bundle\CalendarBundle\Handler\SystemCalendarDeleteHandler
    oro_calendar.calendar_event.handler.delete.class:            Oro\Bundle\CalendarBundle\Handler\CalendarEventDeleteHandler
    oro_calendar.system_calendar_event.datagrid_helper.class:    Oro\Bundle\CalendarBundle\Datagrid\SystemCalendarEventGridHelper

    oro_calendar.strategy.abstract.class:                        Oro\Bundle\CalendarBundle\Model\Recurrence\AbstractStrategy
    oro_calendar.strategy.delegate.class:                        Oro\Bundle\CalendarBundle\Model\Recurrence\DelegateStrategy
    oro_calendar.strategy.daily.class:                           Oro\Bundle\CalendarBundle\Model\Recurrence\DailyStrategy
    oro_calendar.strategy.weekly.class:                          Oro\Bundle\CalendarBundle\Model\Recurrence\WeeklyStrategy
    oro_calendar.strategy.monthly.class:                         Oro\Bundle\CalendarBundle\Model\Recurrence\MonthlyStrategy
    oro_calendar.strategy.yearly.class:                          Oro\Bundle\CalendarBundle\Model\Recurrence\YearlyStrategy
    oro_calendar.strategy.monthnth.class:                        Oro\Bundle\CalendarBundle\Model\Recurrence\MonthNthStrategy
    oro_calendar.strategy.yearnth.class:                         Oro\Bundle\CalendarBundle\Model\Recurrence\YearNthStrategy

    oro_calendar.model.recurrence.class:                         Oro\Bundle\CalendarBundle\Model\Recurrence

    oro_calendar.validator.recurrence.class:                     Oro\Bundle\CalendarBundle\Validator\RecurrenceValidator
    oro_calendar.validator.calendar_event.class:                 Oro\Bundle\CalendarBundle\Validator\CalendarEventValidator

services:
    oro_calendar.listener.entity_listener:
        class: %oro_calendar.listener.entity_listener.class%
        arguments:
            - '@oro_organization.link.security_context'
            - '@oro_calendar.model.recurrence'
        tags:
            - { name: doctrine.event_listener, event: preUpdate }
            - { name: doctrine.event_listener, event: prePersist }
            - { name: doctrine.event_listener, event: onFlush }
            - { name: doctrine.event_listener, event: postFlush }

    oro_calendar.listener.calendar_event_attendees:
        class: Oro\Bundle\CalendarBundle\EventListener\CalendarEventAttendeesListener
        tags:
            - { name: doctrine.event_listener, event: onFlush }

    oro_calendar.listener.datagrid.activity:
        class: %oro_calendar.listener.datagrid.activity.class%
        arguments:
            - '@oro_activity.manager'
            - '@oro_entity.routing_helper'
            - '@oro_locale.settings'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.activity-calendar-event-grid, method: onBuildAfter }

    oro_calendar.datagrid.action_permission_provider:
        class: %oro_calendar.datagrid.action_permission_provider.class%
        arguments:
            - '@oro_security.security_facade'

    oro_calendar.calendar_event.manager.api:
        class: %oro_calendar.calendar_event.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %oro_calendar.calendar_event.entity.class%
            - '@doctrine.orm.entity_manager'

    oro_calendar.calendar_event_guest.manager.api:
        class: Oro\Bundle\CalendarBundle\Manager\CalendarEventGuestApiEntityManager
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %oro_calendar.calendar_event.entity.class%
            - '@doctrine.orm.entity_manager'
            - '@oro_entity.entity_name_resolver'

    oro_calendar.calendar_property.manager.api:
        class: %oro_calendar.calendar_property.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %oro_calendar.calendar_property.entity.class%
            - '@doctrine.orm.entity_manager'
            - '@oro_calendar.calendar_manager'

    oro_calendar.system_calendar.manager.api:
        class: %oro_calendar.system_calendar.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %oro_calendar.system_calendar.entity.class%
            - '@doctrine.orm.entity_manager'

    oro_calendar.twig.dateformat:
        class: %oro_calendar.twig.dateformat.class%
        arguments:
            - '@oro_locale.formatter.date_time'
            - '@oro_config.global'
        tags:
            - { name: twig.extension }

    oro_calendar.twig.recurrence:
        class: '%oro_calendar.twig.recurrence.class%'
        arguments:
            - '@translator'
            - '@oro_calendar.model.recurrence'
        tags:
            - { name: twig.extension }

    oro_calendar.provider.calendar_config:
        class: %oro_calendar.provider.calendar_config.class%
        arguments:
            - '@oro_locale.settings'

    oro_calendar.provider.attendee_email_recipients:
        class: %oro_calendar.provider.attendee_email_recipients.class%
        arguments:
            - '@doctrine'
            - '@oro_email.provider.email_recipients.helper'
        tags:
            - { name: oro_email.recipients_provider, priority: 50 }

    oro_calendar.owner_assignment_checker.calendar:
        class: %oro_calendar.owner_assignment_checker.calendar.class%
        tags:
            - { name: oro_organization.owner_assignment_checker, entity: Oro\Bundle\CalendarBundle\Entity\Calendar }

    oro_calendar.widget_provider.actions.assign_calendar_event:
        parent: oro_ui.widget_provider.action_button.abstract
        arguments:
            - oro_assign_calendar_event_button
            - oro_assign_calendar_event_link
        tags:
            - { name: oro_ui.view_action_provider, group: activity }
            - { name: oro_ui.update_action_provider, group: activity }

    oro_calendar.calendar_event_manager:
        class: %oro_calendar.calendar_event_manager.class%
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_security.security_facade'
            - '@oro_entity.entity_name_resolver'
            - '@oro_calendar.system_calendar_config'

    oro_calendar.calendar_manager:
        class: %oro_calendar.calendar_manager.class%
        arguments:
            - '@oro_calendar.calendar_property_provider'

    oro_calendar.attendee_manager:
        class: %oro_calendar.attendee_manager.class%
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_calendar.attendee_relation_manager'

    oro_calendar.attendee_relation_manager:
        class: %oro_calendar.attendee_relation_manager.class%
        arguments:
            - '@doctrine'
            - '@oro_locale.formatter.name'
            - '@oro_locale.dql.formatter.name'

    oro_calendar.calendar_property_provider:
        class: %oro_calendar.calendar_property_provider.class%
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_entity_config.config_manager'
            - '@oro_entity_extend.extend.field_type_helper'

    oro_calendar.calendar_provider.user:
        class: %oro_calendar.calendar_provider.user.class%
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_entity.entity_name_resolver'
            - '@oro_calendar.calendar_event_normalizer.user'
            - '@oro_calendar.model.recurrence'
        public: false
        tags:
            - { name: oro_calendar.calendar_provider, alias: user }

    oro_calendar.calendar_provider.system:
        class: %oro_calendar.calendar_provider.system.class%
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_calendar.calendar_event_normalizer.system'
            - '@oro_calendar.system_calendar_config'
            - '@oro_security.security_facade'
        public: false
        tags:
            - { name: oro_calendar.calendar_provider, alias: system }

    oro_calendar.calendar_provider.public:
        class: %oro_calendar.calendar_provider.public.class%
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_calendar.calendar_event_normalizer.public'
            - '@oro_calendar.system_calendar_config'
            - '@oro_security.security_facade'
        public: false
        tags:
            - { name: oro_calendar.calendar_provider, alias: public }

    oro_calendar.calendar_event_normalizer.user:
        class: %oro_calendar.calendar_event_normalizer.user.class%
        arguments:
            - '@oro_reminder.entity.manager'
            - '@oro_security.security_facade'
            - '@oro_calendar.attendee_manager'

    oro_calendar.calendar_event_normalizer.system:
        class: %oro_calendar.calendar_event_normalizer.system.class%
        arguments:
            - '@oro_reminder.entity.manager'
            - '@oro_security.security_facade'
            - '@oro_calendar.attendee_manager'

    oro_calendar.calendar_event_normalizer.public:
        class: %oro_calendar.calendar_event_normalizer.public.class%
        arguments:
            - '@oro_reminder.entity.manager'
            - '@oro_security.security_facade'
            - '@oro_calendar.attendee_manager'

    oro_calendar.autocomplete.user_calendar_handler:
        class: %oro_calendar.autocomplete.user_calendar_handler.class%
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_attachment.manager'
            - %oro_user.entity.class%
            - '@oro_entity_config.link.security_context'
            - '@oro_security.ownership_tree_provider'
            - '@oro_security.acl_helper'
            - '@?security.acl.voter.basic_permissions'
        calls:
            - [ setProperties, [["namePrefix", "firstName", "middleName", "lastName", "nameSuffix"]] ]
            - [ setEntityNameResolver, ['@oro_entity.entity_name_resolver'] ]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: user_calendars, acl_resource: oro_user_user_view }
        lazy: true

    oro_calendar.activity_list.provider:
        class: %oro_calendar.activity_list.provider.class%
        arguments:
           - '@oro_entity.doctrine_helper'
           - '@oro_activity.association_helper'
           - '@oro_comment.association_helper'
        tags:
           - {name: oro_activity_list.provider, priority: 50}

    oro_calendar.send_processor.email:
        class: %oro_calendar.send_processor.email.class%
        arguments:
            - '@oro_notification.email_processor'
            - '@doctrine.orm.entity_manager'
            - '@oro_security.security_facade'

    oro_calendar.listener.datagrid.system_calendar:
        class: %oro_calendar.listener.datagrid.system_calendar.class%
        arguments:
            - '@oro_security.security_facade'
            - '@oro_calendar.system_calendar_config'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.system-calendar-grid, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.system-calendar-grid, method: onBuildAfter }

    oro_calendar.datagrid.helper.calendar_event_grid:
        class: %oro_calendar.datagrid.helper.calendar_event_grid.class%
        arguments:
            - '@router'

    oro_calendar.system_calendar_config:
        class: %oro_calendar.system_calendar_config.class%
        arguments:
            - %oro_calendar.enabled_system_calendar%

    oro_calendar.event_listener.navigation:
        class: %oro_calendar.event_listener.navigation.class%
        arguments:
            - '@oro_calendar.system_calendar_config'
        tags:
            - { name: kernel.event_listener, event: oro_menu.configure.application_menu, method: onNavigationConfigure }

    oro_calendar.system_calendar.handler.delete:
        class: %oro_calendar.system_calendar.handler.delete.class%
        parent: oro_soap.handler.delete.abstract
        calls:
            - [setCalendarConfig, ['@oro_calendar.system_calendar_config']]
            - [setSecurityFacade, ['@oro_security.security_facade']]

    oro_calendar.calendar_event.handler.delete:
        class: %oro_calendar.calendar_event.handler.delete.class%
        parent: oro_soap.handler.delete.abstract
        calls:
            - [setRequestStack, ['@request_stack']]
            - [setCalendarConfig, ['@oro_calendar.system_calendar_config']]
            - [setSecurityFacade, ['@oro_security.security_facade']]
            - [setEmailSendProcessor, ['@oro_calendar.send_processor.email']]

    oro_calendar.system_calendar_event.datagrid_helper:
        class: %oro_calendar.system_calendar_event.datagrid_helper.class%
        arguments:
            - '@oro_security.security_facade'

    oro_calendar.workflow.action.create_calendar_event:
        class: Oro\Bundle\CalendarBundle\Workflow\Action\CreateCalendarEventAction
        arguments:
            - '@oro_action.context_accessor'
            - '@doctrine'
        tags:
            - { name: oro_workflow.action, alias: create_calendar_event }

    oro_calendar.autocomplete.attendee_search_handler:
        class: Oro\Bundle\CalendarBundle\Autocomplete\AttendeeSearchHandler
        parent: oro_activity.form.handler.autocomplete
        calls:
            - [setAttendeeRelationManager, ['@oro_calendar.attendee_relation_manager']]


    # Recurrence Strategies
    oro_calendar.recurrence.strategy.abstract:
        class: '%oro_calendar.strategy.abstract.class%'
        abstract: true
        public: false
        arguments:
            - '@translator'
            - '@oro_locale.formatter.date_time'
            - '@oro_locale.settings'

    oro_calendar.recurrence.strategy.delegate:
        class: '%oro_calendar.strategy.delegate.class%'

    oro_calendar.recurrence.strategy:
        alias: oro_calendar.recurrence.strategy.delegate

    oro_calendar.recurrence.strategy.daily:
        class: '%oro_calendar.strategy.daily.class%'
        public: false
        parent: oro_calendar.recurrence.strategy.abstract
        tags:
            - { name: oro_calendar.recurrence.strategy}

    oro_calendar.recurrence.strategy.weekly:
        class: '%oro_calendar.strategy.weekly.class%'
        public: false
        parent: oro_calendar.recurrence.strategy.abstract
        tags:
            - { name: oro_calendar.recurrence.strategy}

    oro_calendar.recurrence.strategy.monthly:
        class: '%oro_calendar.strategy.monthly.class%'
        public: false
        parent: oro_calendar.recurrence.strategy.abstract
        tags:
            - { name: oro_calendar.recurrence.strategy}

    oro_calendar.recurrence.strategy.yearly:
        class: '%oro_calendar.strategy.yearly.class%'
        public: false
        parent: oro_calendar.recurrence.strategy.abstract
        tags:
            - { name: oro_calendar.recurrence.strategy}

    oro_calendar.recurrence.strategy.monthnth:
        class: '%oro_calendar.strategy.monthnth.class%'
        public: false
        parent: oro_calendar.recurrence.strategy.abstract
        tags:
            - { name: oro_calendar.recurrence.strategy}

    oro_calendar.recurrence.strategy.yearnth:
        class: '%oro_calendar.strategy.yearnth.class%'
        public: false
        parent: oro_calendar.recurrence.strategy.abstract
        tags:
            - { name: oro_calendar.recurrence.strategy}

    oro_calendar.model.recurrence:
        arguments:
            - '@validator'
            - '@oro_calendar.recurrence.strategy'
        class: '%oro_calendar.model.recurrence.class%'

    oro_calendar.validator.recurrence:
        class: '%oro_calendar.validator.recurrence.class%'
        arguments:
            - '@oro_calendar.model.recurrence'
        tags:
            - { name: validator.constraint_validator, alias: oro_calendar.recurrence_validator }

    oro_calendar.validator.calendar_event:
        class: '%oro_calendar.validator.calendar_event.class%'
        tags:
            - { name: validator.constraint_validator, alias: oro_calendar.calendar_event_validator }
