<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2018 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 
  for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org. -->
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_3.xsd http://www.exoplatform.org/xml/ns/kernel_1_3.xsd" xmlns="http://www.exoplatform.org/xml/ns/kernel_1_3.xsd">

  <component>
    <type>org.exoplatform.agenda.rest.AgendaCalendarRest</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.rest.AgendaEventRest</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.rest.AgendaSettingsRest</type>
  </component>

  <component>
    <key>org.exoplatform.agenda.storage.AgendaCalendarStorage</key>
    <type>org.exoplatform.agenda.storage.cached.CachedAgendaCalendarStorage</type>
  </component>

  <component>
    <key>org.exoplatform.agenda.storage.AgendaEventStorage</key>
    <type>org.exoplatform.agenda.storage.cached.CachedAgendaEventStorage</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.storage.AgendaEventAttendeeStorage</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.storage.AgendaEventConferenceStorage</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.storage.AgendaEventReminderStorage</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.storage.AgendaRemoteEventStorage</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.storage.AgendaEventDatePollStorage</type>
  </component>

  <component>
    <key>org.exoplatform.agenda.service.AgendaCalendarService</key>
    <type>org.exoplatform.agenda.service.AgendaCalendarServiceImpl</type>
    <init-params>
      <values-param>
        <name>defaultColors</name>
        <value>${exo.agenda.calendar.defaultColor1:#08a554}</value>
        <value>${exo.agenda.calendar.defaultColor2:#f8b121}</value>
        <value>${exo.agenda.calendar.defaultColor3:#ee7429}</value>
        <value>${exo.agenda.calendar.defaultColor4:#e5282c}</value>
        <value>${exo.agenda.calendar.defaultColor5:#e32386}</value>
        <value>${exo.agenda.calendar.defaultColor6:#2aa8e2}</value>
        <value>${exo.agenda.calendar.defaultColor7:#743289}</value>
        <value>${exo.agenda.calendar.defaultColor8:#ac2986}</value>
        <value>${exo.agenda.calendar.defaultColor9:#3853a0}</value>
        <value>${exo.agenda.calendar.defaultColor10:#32388c}</value>
      </values-param>
    </init-params>
  </component>

  <component>
    <key>org.exoplatform.agenda.service.AgendaEventService</key>
    <type>org.exoplatform.agenda.service.AgendaEventServiceImpl</type>
  </component>

  <component>
    <key>org.exoplatform.agenda.service.AgendaEventReminderService</key>
    <type>org.exoplatform.agenda.service.AgendaEventReminderServiceImpl</type>
    <init-params>
      <value-param>
        <name>period.computing.days</name>
        <description>Reminders of occurent events are computed periodically to store its exact date of notification.
        This is the period, in days, of next upcoming events to compute using a Job.</description>
        <value>${exo.agenda.reminder.computing.period:2}</value>
      </value-param>
    </init-params>
  </component>

  <component>
    <key>org.exoplatform.agenda.service.AgendaEventConferenceService</key>
    <type>org.exoplatform.agenda.service.AgendaEventConferenceServiceImpl</type>
    <init-params>
      <value-param>
        <name>webConferencing.default</name>
        <value>${exo.agenda.webConferencing.default:jitsi}</value>
      </value-param>
    </init-params>
  </component>

  <component>
    <key>org.exoplatform.agenda.service.AgendaRemoteEventService</key>
    <type>org.exoplatform.agenda.service.AgendaRemoteEventServiceImpl</type>
  </component>

  <component>
    <key>org.exoplatform.agenda.service.AgendaEventAttendeeService</key>
    <type>org.exoplatform.agenda.service.AgendaEventAttendeeServiceImpl</type>
  </component>

  <component>
    <key>org.exoplatform.agenda.service.AgendaEventDatePollService</key>
    <type>org.exoplatform.agenda.service.AgendaEventDatePollServiceImpl</type>
  </component>

  <component>
    <key>org.exoplatform.agenda.service.AgendaUserSettingsService</key>
    <type>org.exoplatform.agenda.service.AgendaUserSettingsServiceImpl</type>
    <init-params>
      <object-param>
        <name>agenda.user.settings</name>
        <object type="org.exoplatform.agenda.model.AgendaUserSettings">
          <field name="agendaDefaultView">
            <string>${exo.agenda.settings.agendaDefaultView:week}</string>
          </field>
          <field name="agendaWeekStartOn">
            <string>${exo.agenda.settings.agendaWeekStartOn:MO}</string>
          </field>
          <field name="showWorkingTime">
            <boolean>${exo.agenda.settings.showWorkingTime:false}</boolean>
          </field>
          <field name="workingTimeStart">
            <string>${exo.agenda.settings.workingTimeStart:09:00}</string>
          </field>
          <field name="workingTimeEnd">
            <string>${exo.agenda.settings.workingTimeEnd:18:00}</string>
          </field>
          <field name="automaticPushEvents">
            <boolean>${exo.agenda.settings.automaticPushEvents:true}</boolean>
          </field>
        </object>
      </object-param>
      <object-param>
        <name>Default reminder - Before 5 minutes</name>
        <object type="org.exoplatform.agenda.model.EventReminderParameter">
          <field name="before">
            <int>${exo.agenda.reminder.setting.before:5}</int>
          </field>
          <field name="periodType">
            <string>${exo.agenda.reminder.setting.periodType:MINUTE}</string>
          </field>
        </object>
      </object-param>
    </init-params>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.CalendarDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.EventDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.EventAttendeeDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.EventConferenceDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.EventRecurrenceDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.EventReminderDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.RemoteProviderDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.RemoteEventDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.EventDateOptionDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.EventDatePollDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.dao.EventDateVoteDAO</type>
  </component>

  <component>
    <type>org.exoplatform.agenda.plugin.AgendaGuestUserIdentityProvider</type>
  </component>

  <external-component-plugins>
    <target-component>org.exoplatform.social.core.manager.IdentityManager</target-component>
    <component-plugin>
      <name>AgendaGuestUserIdentityProvider plugin</name>
      <set-method>registerIdentityProviders</set-method>
      <type>org.exoplatform.social.core.identity.IdentityProviderPlugin</type>
      <init-params>
        <values-param>
          <name>providers</name>
          <value>org.exoplatform.agenda.plugin.AgendaGuestUserIdentityProvider</value>
        </values-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.social.core.space.spi.SpaceService</target-component>
    <component-plugin>
      <name>AgendaSpaceApplicationListener</name>
      <set-method>registerSpaceLifeCycleListener</set-method>
      <type>org.exoplatform.agenda.listener.AgendaSpaceApplicationListener</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.commons.search.index.IndexingOperationProcessor</target-component>
    <component-plugin>
      <name>AgendaIndexingServiceConnector</name>
      <set-method>addConnector</set-method>
      <type>org.exoplatform.agenda.search.AgendaIndexingServiceConnector</type>
      <description>Agenda ElasticSearch Indexing Connector</description>
      <init-params>
        <value-param>
          <name>mapping.file.path</name>
          <value>${exo.agenda.events.es.mapping.path:jar:/agenda-events-es-mapping.json}</value>
        </value-param>
        <properties-param>
          <name>constructor.params</name>
          <property name="index_alias" value="event_alias" />
          <property name="index_current" value="event_v1" />
        </properties-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.services.listener.ListenerService</target-component>
    <component-plugin>
      <name>exo.agenda.event.created</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.agenda.listener.AgendaReplyOnSaveListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.agenda.event.poll.created</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.agenda.listener.AgendaReplyOnSaveListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.agenda.event.updated</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.agenda.listener.AgendaReplyOnSaveListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.agenda.event.poll.voted</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.agenda.listener.AgendaVoteListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.agenda.event.poll.dismissed</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.agenda.listener.AgendaVoteListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.agenda.event.poll.voted.all</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.agenda.listener.AgendaVotesListener</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins profiles="analytics">
    <target-component>org.exoplatform.services.listener.ListenerService</target-component>
    <component-plugin>
      <name>exo.agenda.event.created</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.agenda.listener.analytics.AgendaSavedEventListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.agenda.event.updated</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.agenda.listener.analytics.AgendaSavedEventListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.agenda.event.responseSent</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.agenda.listener.analytics.AgendaEventResponseListener</type>
    </component-plugin>
  </external-component-plugins>

</configuration>
