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

/**
 * Query the about us page
 */
export async function getAboutUsPage() {
  const data = await fetchAPI(
    gql`
      query AboutUsPage {
        page(id: "about-us", idType: URI) {
          title
          content
          seo {
            fullHead
          }
          featuredImage {
            node {
              alt: altText
              imageUrl: sourceUrl
              placeholder: sourceUrl(size: THUMBNAIL)
            }
          }
          aboutUsPageContent {
            heroSection {
              heroTitle
              mainDescription
              subHeroText
              subHeroTitle
            }
            subHeroFullImageSection: fullImageSection {
              enableFullImage
              image: fullImage {
                alt: altText
                imageUrl: sourceUrl
                placeholder: sourceUrl(size: THUMBNAIL)
              }
            }
            twoColumnSection {
              leftColumn {
                columnTitle
                columnText
              }
              rightColumn {
                columnTitle
                columnText
              }
            }
            familyOfBrandsSection {
              title
              descriptionText
            }
            familyOfBrandsFullImageSection {
              enableFullImage
              image: brandsFullImage {
                alt: altText
                imageUrl: sourceUrl
                placeholder: sourceUrl(size: THUMBNAIL)
              }
            }
            lbsSection {
              title
              descriptionText
              lbsLink {
                title
                url
              }
            }
            lbsFullImageSection {
              enableFullImage
              image: lbsFullImage {
                alt: altText
                imageUrl: sourceUrl
                placeholder: sourceUrl(size: THUMBNAIL)
              }
            }
            archivalProductsSection {
              title
              descriptionText
              buttonLink {
                title
                url
              }
            }
            ourHistorySection {
              title
              productionSpecsSection {
                specTitle
                specDescription
              }
              photoGrid {
                image {
                  alt: altText
                  imageUrl: sourceUrl
                  placeholder: sourceUrl(size: THUMBNAIL)
                }
              }
              largeImagePlacement
            }
            ourPeopleSection {
              title
              descriptionText
              teamMembers {
                fieldGroupName
                memberName
                jobTitle
                phoneNumber
                email
                memberImage {
                  alt: altText
                  imageUrl: sourceUrl
                  placeholder: sourceUrl(size: THUMBNAIL)
                }
              }
              executiveTeamMembers {
                fieldGroupName
                memberName
                jobTitle
                phoneNumber
                email
                memberImage {
                  alt: altText
                  imageUrl: sourceUrl
                  placeholder: sourceUrl(size: THUMBNAIL)
                }
              }
            }
            awardsFullImageSection {
              enableFullImage
              image: awardsFullImage {
                alt: altText
                imageUrl: sourceUrl
                placeholder: sourceUrl(size: THUMBNAIL)
              }
            }
            awardsSection {
              awards {
                awardTitle
                awardBlurb
                awardDescription
                awardImage {
                  alt: altText
                  imageUrl: sourceUrl
                  placeholder: sourceUrl(size: THUMBNAIL)
                }
                awardLink {
                  title
                  url
                }
              }
            }
          }
          customCtaSection {
            enableCta
            ctaText
            ctaLink {
              title
              url
            }
          }
        }
      }
    `
  )

  return data
}
