<template>
  <NewsListingBlock
    :extra-filters="extraFilters"
    :grid-gap="$_theme('spacingL')"
    :block-options="{
      title: $_tr('customs.ENTITY.NEWS.title'),
      titleTag: 'h3'
    }"
  >
    <template #newsItem="{ item }">
      <Resume
        v-bind="item"
        :key="item.uuid"
        :to="{
          name: 'NewsPage',
          params: { slug: item.slug[0] }
        }"
      />
    </template>
  </NewsListingBlock>
</template>

<script>
import NewsListingBlock from '@inside-news/components/lib/NewsListingBlock'
import Resume from '@inside-news/components/lib/Resume'

export default {
  name: 'CorporateNews',
  components: {
    NewsListingBlock,
    Resume
  },
  computed: {
    coroporateNewsCategory() {
      return this.$store.getters.getInsideSettings(
        'general.corporate_news_category'
      )
    },
    extraFilters() {
      return {
        'is_featured:ne': 1,
        ...(this.coroporateNewsCategory && {
          news_categories: {
            'uuid:eq': this.coroporateNewsCategory
          }
        }),
        limit: 8
      }
    }
  }
}
</script>
