<!--

  This file is part of the Meeds project (https://meeds.io/).

  Copyright (C) 2023 Meeds Association contact@meeds.io

  This program 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 3 of the License, or (at your option) any later version.
  This program 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 program; if not, write to the Free Software Foundation,
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

-->
<binding>

  <format type="java.lang.String[]"
          serializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.serializeStringArray"
          deserializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.deserializeStringArray"/>

  <mapping class="org.exoplatform.portal.config.model.Properties" name="properties"
           marshaller="org.exoplatform.portal.config.serialize.JibxPropertiesMapper"
           unmarshaller="org.exoplatform.portal.config.serialize.JibxPropertiesMapper"/>

  <mapping class="org.exoplatform.portal.config.model.LocalizedString"
           name="label"
           unmarshaller="org.exoplatform.portal.config.serialize.LocalizedValueMapper"
           marshaller="org.exoplatform.portal.config.serialize.LocalizedValueMapper">
  </mapping>

  <mapping name="portlet-application"
           label="portlet-application"
           class="org.exoplatform.portal.config.serialize.PortletApplication"
           marshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler"
           unmarshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler">
  </mapping>

  <mapping name="css-style" label="css-style" class="org.exoplatform.portal.config.model.ModelStyle">
    <value name="margin-top" field="marginTop" usage="optional" />
    <value name="margin-bottom" field="marginBottom" usage="optional" />
    <value name="margin-right" field="marginRight" usage="optional" />
    <value name="margin-left" field="marginLeft" usage="optional" />
    <value name="radius-top-right" field="radiusTopRight" usage="optional" />
    <value name="radius-top-left" field="radiusTopLeft" usage="optional" />
    <value name="radius-bottom-right" field="radiusBottomRight" usage="optional" />
    <value name="radius-bottom-left" field="radiusBottomLeft" usage="optional" />
    <value name="mobile-hidden" field="mobileHidden" usage="optional" />
    <value name="border-color" field="borderColor" usage="optional" />
    <value name="border-size" field="borderSize" usage="optional" />
    <value name="box-shadow" field="boxShadow" usage="optional" />
    <value name="background-color" field="backgroundColor" usage="optional" />
    <value name="background-image" field="backgroundImage" usage="optional" />
    <value name="background-effect" field="backgroundEffect" usage="optional" />
    <value name="background-position" field="backgroundPosition" usage="optional" />
    <value name="background-size" field="backgroundSize" usage="optional" />
    <value name="background-repeat" field="backgroundRepeat" usage="optional" />
    <value name="text-title-color" field="textTitleColor" usage="optional" />
    <value name="text-title-color" field="textTitleColor" usage="optional" />
    <value name="text-title-font-size" field="textTitleFontSize" usage="optional" />
    <value name="text-title-font-weight" field="textTitleFontWeight" usage="optional" />
    <value name="text-title-font-style" field="textTitleFontStyle" usage="optional" />
    <value name="text-header-color" field="textHeaderColor" usage="optional" />
    <value name="text-header-font-size" field="textHeaderFontSize" usage="optional" />
    <value name="text-header-font-weight" field="textHeaderFontWeight" usage="optional" />
    <value name="text-header-font-style" field="textHeaderFontStyle" usage="optional" />
    <value name="text-color" field="textColor" usage="optional" />
    <value name="text-font-size" field="textFontSize" usage="optional" />
    <value name="text-font-weight" field="textFontWeight" usage="optional" />
    <value name="text-font-style" field="textFontStyle" usage="optional" />
    <value name="text-subtitle-color" field="textSubtitleColor" usage="optional" />
    <value name="text-subtitle-font-size" field="textSubtitleFontSize" usage="optional" />
    <value name="text-subtitle-font-weight" field="textSubtitleFontWeight" usage="optional" />
    <value name="text-subtitle-font-style" field="textSubtitleFontStyle" usage="optional" />
  </mapping>

  <mapping class="org.exoplatform.portal.config.serialize.model.Preference" name="preference" label="preference">
    <value name="name" field="name"/>
    <collection field="values" item-type="java.lang.String" factory="org.jibx.runtime.Utility.arrayListFactory">
      <value name="value" style="element"/>
    </collection>
    <value name="read-only" field="readOnly" usage="optional"/>
  </mapping>

  <mapping name="cell" label="cell" class="org.exoplatform.portal.config.serialize.model.Cell">
    <value name="id" usage="optional" field="id" style="attribute"/>
    <value name="col-span" field="colSpan" default="1" usage="optional" style="attribute"/>
    <value name="row-span" field="rowSpan" default="1" usage="optional" style="attribute"/>
    <value name="cssClass" field="cssClass" usage="optional" style="attribute"/>
    <value name="profiles" field="profiles" usage="optional" style="attribute"/>
    <value
      name="access-permissions"
      field="accessPermissions"
      usage="optional"
      default="Everyone"
      serializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.serializePermissions"
      deserializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.deserializePermissions" />
    <structure
      field="cssStyle"
      map-as="org.exoplatform.portal.config.model.ModelStyle"
      usage="optional" />
    <collection field="children" ordered="false">
      <structure map-as="org.exoplatform.portal.config.serialize.PortletApplication" usage="optional"/>
    </collection>
  </mapping>

  <mapping name="column" label="column" class="org.exoplatform.portal.config.serialize.model.Column">
    <value name="id" usage="optional" field="id" style="attribute"/>
    <value name="col-span" field="colSpan" usage="optional" style="attribute"/>
    <value name="cssClass" field="cssClass" usage="optional" style="attribute"/>
    <value name="profiles" field="profiles" usage="optional" style="attribute"/>
    <value
      name="access-permissions"
      field="accessPermissions"
      usage="optional"
      default="Everyone"
      serializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.serializePermissions"
      deserializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.deserializePermissions" />
    <collection field="children" ordered="false">
      <structure map-as="org.exoplatform.portal.config.serialize.PortletApplication" usage="optional"/>
      <structure map-as="org.exoplatform.portal.config.model.Container" usage="optional"/>
    </collection>
  </mapping>

  <mapping name="section-grid" label="section-grid" class="org.exoplatform.portal.config.serialize.model.GridSection">
    <value name="id" usage="optional" field="id" style="attribute"/>
    <value name="cols" field="colsCount" usage="optional" style="attribute"/>
    <value name="rows" field="rowsCount" usage="optional" style="attribute"/>
    <value name="cssClass" field="cssClass" usage="optional" style="attribute"/>
    <value name="profiles" field="profiles" usage="optional" style="attribute"/>
    <value
      name="access-permissions"
      field="accessPermissions"
      usage="optional"
      default="Everyone"
      serializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.serializePermissions"
      deserializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.deserializePermissions" />
    <collection field="children" ordered="false">
      <structure map-as="org.exoplatform.portal.config.serialize.model.Cell" usage="optional"/>
    </collection>
  </mapping>

  <mapping name="section-columns" label="section-columns" class="org.exoplatform.portal.config.serialize.model.FlexSection">
    <value name="id" usage="optional" field="id" style="attribute"/>
    <value name="height" field="height" usage="optional" style="attribute"/>
    <value name="cssClass" field="cssClass" usage="optional" style="attribute"/>
    <value name="mobile-columns-style" field="mobileColumns" usage="optional" style="attribute"/>
    <value name="sticky-beahvior" field="stickyBeahvior" usage="optional" style="attribute"/>
    <value name="profiles" field="profiles" usage="optional" style="attribute"/>
    <value
      name="access-permissions"
      field="accessPermissions"
      usage="optional"
      default="Everyone"
      serializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.serializePermissions"
      deserializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.deserializePermissions" />
    <collection field="children" ordered="false">
      <structure map-as="org.exoplatform.portal.config.serialize.model.Column" usage="optional"/>
    </collection>
  </mapping>

  <mapping name="container" label="container" class="org.exoplatform.portal.config.model.Container">
    <value name="id" field="id" usage="optional" style="attribute"/>
    <value
      name="template"
      field="template"
      default="system:/groovy/portal/webui/container/UIContainer.gtmpl"
      usage="optional"
      style="attribute" />
    <value name="name" field="name" usage="optional" />
    <value name="title" field="title" usage="optional"/>
    <value name="icon" field="icon" usage="optional"/>
    <value
      name="access-permissions"
      field="accessPermissions"
      usage="optional"
      default="Everyone"
      serializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.serializePermissions"
      deserializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.deserializePermissions"/>
    <value name="factory-id" field="factoryId" usage="optional"/>
    <value name="description" field="description" usage="optional"/>
    <value name="width" usage="optional" field="width" style="attribute"/>
    <value name="height" usage="optional" field="height" style="attribute"/>
    <value name="cssClass" field="cssClass" usage="optional" style="attribute"/>
    <value name="profiles" field="profiles" usage="optional" style="attribute"/>
    <structure
      field="cssStyle"
      map-as="org.exoplatform.portal.config.model.ModelStyle"
      usage="optional" />
    <collection field="children" ordered="false">
      <structure map-as="org.exoplatform.portal.config.serialize.model.GridSection" usage="optional"/>
      <structure map-as="org.exoplatform.portal.config.serialize.model.FlexSection" usage="optional"/>
      <structure map-as="org.exoplatform.portal.config.model.Container" usage="optional"/>
      <structure map-as="org.exoplatform.portal.config.model.PageBody" usage="optional"/>
      <structure map-as="org.exoplatform.portal.config.model.SiteBody" usage="optional"/>
      <structure map-as="org.exoplatform.portal.config.serialize.PortletApplication" usage="optional"/>
    </collection>
  </mapping>

  <mapping name="page" label="page" class="org.exoplatform.portal.config.model.Page">
    <value name="profiles" field="profiles" usage="optional" style="attribute"/>
    <structure name="page-id" usage="optional"/>
    <structure name="owner-type" usage="optional"/>
    <structure name="owner-id" usage="optional"/>
    <value name="name" field="name"/>
    <value name="title" field="title" usage="optional"/>
    <value name="factory-id" field="factoryId" usage="optional"/>
    <value name="access-permissions" field="accessPermissions" usage="optional" default="Everyone" serializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.serializePermissions"
          deserializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.deserializePermissions"/>
    <value name="edit-permission" field="editPermission" usage="optional"/>
    <value name="show-max-window" field="showMaxWindow" usage="optional"/>
    <value name="hide-shared-layout" field="hideSharedLayout" usage="optional"/>
    <structure
      field="cssStyle"
      map-as="org.exoplatform.portal.config.model.ModelStyle"
      usage="optional" />
    <collection field="children" ordered="false">
      <structure map-as="org.exoplatform.portal.config.model.Container" usage="optional"/>
      <structure map-as="org.exoplatform.portal.config.model.PageBody" usage="optional"/>
      <structure map-as="org.exoplatform.portal.config.serialize.PortletApplication" usage="optional"/>
    </collection>
  </mapping>

  <mapping name="node" label="node" class="org.exoplatform.portal.config.model.PageNode">
    <value name="name" field="name"/>
    <collection field="labels" ordered="false" factory="org.exoplatform.portal.config.model.I18NString.create">
      <structure map-as="org.exoplatform.portal.config.model.LocalizedString" usage="optional"/>
    </collection>
    <value name="icon" field="icon" usage="optional"/>
    <value name="start-publication-date" field="startPublicationDate" usage="optional"/>
    <value name="end-publication-date" field="endPublicationDate" usage="optional"/>
    <value name="visibility" field="visibility" usage="optional" default="DISPLAYED"/>
    <value name="page-reference" field="pageReference" usage="optional"
           deserializer="org.exoplatform.portal.config.serialize.JibxStringSerialize.deserializeString"/>
    <value name="insertion-index" field="order" usage="optional" default="-1" />
    <collection get-method="getNodes" set-method="setNodes" usage="optional"
                item-type="org.exoplatform.portal.config.model.PageNode"/>
  </mapping>

  <mapping name="page-body" label="pageBody" class="org.exoplatform.portal.config.model.PageBody">
  </mapping>

  <mapping name="site-body" label="siteBody" class="org.exoplatform.portal.config.model.SiteBody">
  </mapping>

  <mapping name="portal-config" class="org.exoplatform.portal.config.model.PortalConfig" ordered="false">
    <value name="portal-name" field="name"/>
    <value name="label" field="label" default=""/>
    <value name="description" field="description" default=""/>
    <value name="locale" field="locale"/>
    <value name="access-permissions" field="accessPermissions" usage="optional" default="Everyone" serializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.serializePermissions"
          deserializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.deserializePermissions"/>
    <value name="edit-permission" field="editPermission" usage="optional"/>
    <value name="skin" field="skin" usage="optional"/>
    <value name="displayed" field="displayed" default="true"/>
    <value name="display-order" field="displayOrder" default="0"/>
    <structure field="properties" usage="optional"/>
    <structure name="portal-layout" using="container" field="portalLayout" usage="optional"/>
  </mapping>

  <mapping name="page-set" class="org.exoplatform.portal.config.model.Page$PageSet">
    <collection field="pages" item-type="org.exoplatform.portal.config.model.Page"/>
  </mapping>

  <mapping name="node-navigation" class="org.exoplatform.portal.config.model.PageNavigation">
    <value name="owner-type" field="ownerType" usage="optional"/>
    <value name="owner-id" field="ownerId" usage="optional"/>
    <value name="priority" field="priority" usage="optional" default="-1"/>
    <collection field="fragments" ordered="false">
      <structure map-as="org.exoplatform.portal.config.model.NavigationFragment" usage="optional"/>
    </collection>
  </mapping>

  <mapping name="page-nodes" class="org.exoplatform.portal.config.model.NavigationFragment">
    <value name="parent-uri" field="parentURI" usage="optional"/>
    <collection get-method="getNodes" set-method="setNodes" ordered="false">
      <structure map-as="org.exoplatform.portal.config.model.PageNode" usage="optional"/>
    </collection>
  </mapping>

</binding>
