!content-type:inspiration
name: inspirations-app
icon: icon-inspirations
label: Inspirations
permissions:
  roles:
    content-editor: content-editor
    power-editor: power-editor
    administrator: administrator
    superuser: superuser
subApps:
  browser:
    actions:
      showPreview:
        $type: openDetailSubappAction
        icon: icon-view
        viewType: view
        appName: inspirations-app
        subAppName: preview
        availability:
          writePermissionRequired: true
          nodeTypes:
            inspiration: inspiration
      addToTranslationBatch:
        label: Add to translation batch
        dialogName: content-translation-support-ext-core:addToTranslationBatch
        icon: icon-add-folder
        class: info.magnolia.translation.ext.core.app.batch.action.OpenMultiEditDialogAction$Definition
        availability:
          writePermissionRequired: true
          access:
            roles:
              superuser: superuser
          nodeTypes:
            inspiration: inspiration
            asset: mgnl:asset
            configuration: mgnl:contentNode
            content: mgnl:page
            folder: mgnl:folder
            templateOrResource: mgnl:content
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
          multiple: true
          root: false
    actionbar:
      sections:
        item:
          groups:
            addActions:
              items:
                showPreview: {}
            activationActions:
              items:
                addToTranslationBatch: {}
  detail:
    form:
      layout:
        $type: tabbedLayout
        tabs:
          main:
            fields:
              - name: name
              - name: text
              - name: hero
              - name: heroProduct
              - name: searchText
              - name: info
          productLines:
            fields:
              - name: productLines
      properties:
        name:
          label: Title
          required: true
          i18n: true
        text:
          i18n: true
          rows: 5
        mgnl:template:
          $type: hiddenField
          defaultValue: 'headless-ecommerce:pages/Inspiration'
        heroProduct:
          $type: ecommerceLinkField
        searchText:
          i18n: true
        info:
          label: ''
          $type: staticField
          value: Search text will be run and applied <b>ONLY</b> against <b>Commercetools</b> products.
        productLines:
          field:
            properties:
              productCards:
                field:
                  properties:
                    text:
                      rows: 5
                      i18n: true
                    product:
                      $type: ecommerceLinkField
  preview:
    class: info.magnolia.pages.app.detail.PageDetailDescriptor
    extensionViews:
      title:
        class: info.magnolia.pages.app.detail.extension.PageTitleViewDefinition
      status:
        class: info.magnolia.pages.app.detail.extension.PublishingStatusViewDefinition
      link:
        class: info.magnolia.pages.app.detail.extension.NativePagePreviewLinkViewDefinition
      language:
        class: info.magnolia.pages.app.detail.extension.LanguageSelectorViewDefinition
    itemProvider:
      $type: jcrNodeFromLocationProvider
    actions:
      activate:
        $type: jcrCommandAction
        icon: icon-publish
        catalog: default
        command: publish
        params:
          recursive: true
        availability:
          writePermissionRequired: true
          rules:
            isPublishable: &isPublishable
              $type: jcrPublishableRule
      deactivate:
        $type: jcrCommandAction
        icon: icon-unpublish
        catalog: default
        command: unpublish
        availability:
          writePermissionRequired: true
          rules:
            isPublishable: *isPublishable
            notDeleted:
              $type: jcrIsDeletedRule
              negate: true
            isPublished:
              $type: jcrPublishedRule
    actionbar:
      sections:
        previewActions:
          groups:
            publish:
              items:
                - name: activate
                - name: deactivate
          availability:
            rules:
              inPreview:
                class: info.magnolia.pages.app.detail.action.availability.IsPreviewRuleDefinition
