import { gql } from 'graphql-request'
import fetchAPI from '@/lib/api/fetchAPI'

/**
 * Query the about us page
 */
export async function getCareersPage() {
  const data = await fetchAPI(
    gql`
    query CareersPage {
      page(id: "careers", idType: URI) {
        title
        content
        seo {
          fullHead
        }
        featuredImage {
          node {
            alt: altText
            imageUrl: sourceUrl
            placeholder: sourceUrl(size: THUMBNAIL)
          }
        }
        careers {
          heroSection {
            heroTitle
            mainDescription
            subHeroTitle
            subHeroDescription
            photoSection {
              largeImagePlacement
              photoGrid {
                image {
                  alt: altText
                  imageUrl: sourceUrl
                  placeholder: sourceUrl(size: THUMBNAIL)
                }
              }
            }
          }
          quoteSection {
            quoteText
            quoteAuthor
            authorDescription
            quoteAccentColor
          }
          benefitsSection {
            image: fullImage {
              alt: altText
              imageUrl: sourceUrl
              placeholder: sourceUrl(size: THUMBNAIL)
            }
            benefitsTitle
            benefitsDescription
            benefitList {
              benefitItem
            }
            benefitsAddendum
          }
          openPositionsSection {
            openPositionsTitle
            openPositionsDescription
            openPositionsLink {
              title
              url
            }
            image: openPositionFullImage {
              alt: altText
              imageUrl: sourceUrl
              placeholder: sourceUrl(size: THUMBNAIL)
            }
          }
        }
        customCtaSection {
          enableCta
          ctaText
          ctaLink {
            title
            url
          }
        }
      }
    }
    `
  )

  return data
}
