<template>
  <Parent
    v-bind="getAttrs($attrs)"
    :extra-categories-config="extraCategoriesConfig"
    :slug="slug"
    :to="{ name: 'NewsPage', params: { slug: slug[0] } }"
  />
</template>

<script>
import Parent from '@inside-news/components/lib/Capsule'

import { getAttrs } from '@inside-library/helpers/Attrs'

export default {
  name: 'CapsuleNews',
  components: { Parent },
  props: {
    slug: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      extraCategoriesConfig: {
        subsidiaries: {
          data: (data, contentType, { getData }) => getData(data, contentType),
          disabledOn: ['NewsListingPage'],
          href: ({ uuid }) => ({
            name: 'NewsListingPage',
            query: { subsidiaries: uuid }
          })
        }
      }
    }
  },
  methods: {
    getAttrs
  }
}
</script>
