services:
    oro_calendar.calendar_event.form.type:
        class: Oro\Bundle\CalendarBundle\Form\Type\CalendarEventType
        arguments:
            - '@oro_calendar.calendar_event.notification_manager'
            - '@security.authorization_checker'
            - '@oro_security.token_accessor'
            - '@doctrine'
        tags:
            - { name: form.type, alias: oro_calendar_event }

    oro_calendar.calendar_event.form.type.api:
        class: Oro\Bundle\CalendarBundle\Form\Type\CalendarEventApiType
        arguments:
            - '@oro_calendar.calendar_event_manager'
            - '@oro_calendar.calendar_event.notification_manager'
        tags:
            - { name: form.type, alias: oro_calendar_event_api }

    oro_calendar.calendar_event.form:
        class:    'Symfony\Component\Form\Form'
        factory: ['@form.factory', 'createNamed']
        arguments:
            - "oro_calendar_event_form"
            - Oro\Bundle\CalendarBundle\Form\Type\CalendarEventType

    oro_calendar.calendar_event.form.api:
        class:   'Symfony\Component\Form\Form'
        public: true
        factory: ['@form.factory', 'createNamed']
        arguments:
            - "oro_calendar_event_form"
            - Oro\Bundle\CalendarBundle\Form\Type\CalendarEventApiType

    oro_calendar.calendar_event.form.handler.abstract:
        class: 'Oro\Bundle\CalendarBundle\Form\Handler\AbstractCalendarEventHandler'
        abstract: true
        arguments:
            - '@request_stack'
            - '@doctrine'
            - '@oro_security.token_accessor'
            - '@oro_activity.manager'
            - '@oro_calendar.calendar_event_manager'
            - '@oro_calendar.calendar_event.notification_manager'
            - '@oro_featuretoggle.checker.feature_checker'

    oro_calendar.calendar_event.form.handler:
        class: 'Oro\Bundle\CalendarBundle\Form\Handler\CalendarEventHandler'
        public: true
        parent: 'oro_calendar.calendar_event.form.handler.abstract'
        calls:
            - ['setForm', ['@oro_calendar.calendar_event.form']]
            - ['setEntityRoutingHelper', ['@oro_entity.routing_helper']]

    Oro\Bundle\CalendarBundle\Form\Handler\CalendarEventHandler:
        alias: 'oro_calendar.calendar_event.form.handler'

    Oro\Bundle\CalendarBundle\Form\Handler\SystemCalendarEventHandler:
        alias: oro_calendar.system_calendar_event.form.handler

    oro_calendar.system_calendar_event.form.handler:
        class: 'Oro\Bundle\CalendarBundle\Form\Handler\SystemCalendarEventHandler'
        public: true
        parent: 'oro_calendar.calendar_event.form.handler.abstract'
        calls:
            - ['setForm', ['@oro_calendar.calendar_event.form']]

    oro_calendar.calendar_event.form.handler.api:
        class: 'Oro\Bundle\CalendarBundle\Form\Handler\CalendarEventApiHandler'
        public: true
        parent: 'oro_calendar.calendar_event.form.handler.abstract'
        calls:
            - ['setForm', ['@oro_calendar.calendar_event.form.api']]

    oro_calendar.attendees_select.form.type:
        class: Oro\Bundle\CalendarBundle\Form\Type\CalendarEventAttendeesSelectType
        arguments:
            - '@oro_calendar.attendees_select.transformer'
            - '@oro_calendar.attendee_manager'
            - '@oro_calendar.attendee_relation_manager'
        tags:
            - { name: form.type, alias: oro_calendar_event_attendees_select }

    oro_calendar.attendees_select.transformer:
        class: Oro\Bundle\CalendarBundle\Form\DataTransformer\AttendeesToViewTransformer
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_calendar.attendee_manager'

    oro_calendar.attendees_api.form.type:
        class: Oro\Bundle\CalendarBundle\Form\Type\CalendarEventAttendeesApiType
        tags:
            - { name: form.type, alias: oro_calendar_event_attendees_api }

    oro_calendar.calendar_property.form.type.api:
        class: Oro\Bundle\CalendarBundle\Form\Type\CalendarPropertyApiType
        tags:
            - { name: form.type, alias: oro_calendar_property_api }

    oro_calendar.calendar_property.form.api:
        class:    'Symfony\Component\Form\Form'
        public: true
        factory: ['@form.factory', 'createNamed']
        arguments:
            - ''
            - Oro\Bundle\CalendarBundle\Form\Type\CalendarPropertyApiType

    oro_calendar.calendar_property.form.handler.api:
        class: Oro\Bundle\CalendarBundle\Form\Handler\CalendarPropertyApiHandler
        public: true
        arguments:
            - '@oro_calendar.calendar_property.form.api'
            - '@request_stack'
            - '@doctrine.orm.entity_manager'

    oro_calendar.calendar_choice.form.type:
        class: Oro\Bundle\CalendarBundle\Form\Type\CalendarChoiceType
        arguments:
            - '@oro_calendar.calendar_event_manager'
            - '@translator'
        tags:
            - { name: form.type, alias: oro_calendar_choice }

    oro_calendar.calendar_choice_template.form.type:
        class: Oro\Bundle\CalendarBundle\Form\Type\CalendarChoiceTemplateType
        tags:
            - { name: form.type, alias: oro_calendar_choice_template }

    oro_calendar.system_calendar.form.type:
        class: Oro\Bundle\CalendarBundle\Form\Type\SystemCalendarType
        arguments:
            - '@security.authorization_checker'
            - '@oro_calendar.system_calendar_config'
        tags:
            - { name: form.type, alias: oro_system_calendar }

    oro_calendar.system_calendar.form:
        class:   'Symfony\Component\Form\Form'
        factory: ['@form.factory', 'createNamed']
        arguments:
            - "oro_system_calendar_form"
            - Oro\Bundle\CalendarBundle\Form\Type\SystemCalendarType

    Oro\Bundle\CalendarBundle\Form\Handler\SystemCalendarHandler:
        alias: oro_calendar.system_calendar.form.handler

    oro_calendar.system_calendar.form.handler:
        class: Oro\Bundle\CalendarBundle\Form\Handler\SystemCalendarHandler
        public: true
        arguments:
            - '@oro_calendar.system_calendar.form'
            - '@request_stack'
            - '@doctrine.orm.entity_manager'

    oro_calendar.extension.acl_label:
        class: Oro\Bundle\CalendarBundle\Form\Extension\AclObjectLabelTypeExtension
        tags:
            - { name: form.type_extension, alias: oro_acl_label, extended_type: Oro\Bundle\SecurityBundle\Form\Type\ObjectLabelType }

    oro_calendar.extension.calendar_event:
        class: Oro\Bundle\CalendarBundle\Form\Extension\CalendarEventTypeExtension
        arguments:
            - '@oro_calendar.resolver.event_organizer'
        tags:
            - { name: form.type_extension, alias: oro_calendar_event, extended_type: Oro\Bundle\CalendarBundle\Form\Type\CalendarEventType }

    oro_calendar.extension.calendar_event_api:
        class: Oro\Bundle\CalendarBundle\Form\Extension\CalendarEventApiTypeExtension
        arguments:
            - '@oro_calendar.resolver.event_organizer'
        tags:
            - { name: form.type_extension, alias: oro_calendar_event_api, extended_type: Oro\Bundle\CalendarBundle\Form\Type\CalendarEventApiType }

    oro_calendar.recurrence.form.type:
        class: Oro\Bundle\CalendarBundle\Form\Type\RecurrenceFormType
        arguments:
            - '@oro_calendar.model.recurrence'
        tags:
            - { name: form.type, alias: oro_calendar_event_recurrence }
