<template>
  <Parent
    v-bind="getAttrs($attrs)"
    :extra-categories-config="m_extraCategoriesConfig"
    :scaffold-overrides="pageOverride"
  />
</template>

<script>
import { markRaw } from 'vue'

import Parent from '@inside-news/components/lib/Full'
import CoAuthors from './CoAuthors'

import newsCategoriesMixin from '../../mixins/news-categories-mixin'
import { getAttrs } from '@inside-library/helpers/Attrs'

export default {
  name: 'FullNews',
  components: { Parent, CoAuthors },
  mixins: [newsCategoriesMixin],
  methods: {
    getAttrs,
    pageOverride(data, { replaceItem }) {
      replaceItem('author', {
        id: 'co-authors',
        tag: markRaw(CoAuthors),
        data: { data: [...data.co_authors.data, data.authors] },
        hideIf: () =>
          !data.co_authors.data.length && !data.authors.firstname.length
      })
    }
  }
}
</script>
