<template>
  <Page
    :printable="false"
    :extraFields="[criticalityFields, spaceFields, coAuthorsFields]"
    :showAuthor="true"
    :authorFields="[authorFields]"
    :relatedOptions="{
      extraFields: [spaceFields],
      componentAttributes: () => ({
        extraCategoriesConfig: m_extraCategoriesConfig
      })
    }"
    :separator-color="$_theme('colorPrimary')"
  />
</template>

<script>
import Page from '@inside-news/components/pages/NewsPage'

import newsCategoriesMixin from '../../mixins/news-categories-mixin'

export default {
  name: 'NewsPage',
  components: { Page },
  mixins: [newsCategoriesMixin],
  data() {
    const reactions = { reactions: ['count', { users: ['uuid'] }] }

    return {
      criticalityFields: {
        news_criticalities: {
          fields: ['title', 'color', 'image'],
          filters: { 'status:eq': 1 }
        }
      },
      spaceFields: {
        spaces: {
          fields: ['uuid', 'title', 'slug'],
          filters: { 'status:eq': 1 }
        }
      },
      coAuthorsFields: {
        co_authors: ['uuid', 'image', 'firstname', 'lastname', reactions]
      },
      authorFields: reactions
    }
  }
}
</script>
