import { gql } from 'graphql-request'

export const POST_FRAGMENT = gql`
  fragment PostFields on Post {
    id
    uri
    title
    date
    excerpt
    content
    seo {
      fullHead
    }
    featuredImage {
      node {
        alt: altText
        imageUrl: sourceUrl
        placeholder: sourceUrl(size: THUMBNAIL)
      }
    }
    blogContent @include(if: $isIndex) {
      accentColor
    }
    blogContent @skip(if: $isIndex) {
      accentColor
      blogType
      eventDate
      eventBlurb
      enableEventRegisterButton
      registerButtonLink {
        target
        title
        url
      }
      blogLayoutSections {
        __typename
        ... on Post_Blogcontent_BlogLayoutSections_BodyContentLayout {
          bodyContent
        }
        ... on Post_Blogcontent_BlogLayoutSections_SectionIntroLayout {
          sectionIntro
        }
        ... on Post_Blogcontent_BlogLayoutSections_EmbedContentLayout {
          embedUrl
          embedCaption
        }
        ... on Post_Blogcontent_BlogLayoutSections_CtaLayout {
          ctaButtonLink {
            url
            title
            target
          }
          ctaText
        }
        ... on Post_Blogcontent_BlogLayoutSections_Divider {
          __typename
        }
        ... on Post_Blogcontent_BlogLayoutSections_BlogQuoteLayout {
          company
          fullName
          jobTitle
          quoteText
        }
      }
      sideBarContent {
        blogSidebarText
        eventSidebarDetails {
          label
          details
        }
      }
    }
    customCtaSection @skip(if: $isIndex) {
      ctaText
      ctaLink {
        target
        title
        url
      }
      enableCta
    }
    categories {
      edges {
        node {
          slug
          name
        }
      }
    }
  }
`
