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

/**
 * Query the glossary page
 */
export async function getDesignToolsPage() {
  const data = await fetchAPI(
    gql`
      query DesignToolsPage {
        page(id: "design-tools", idType: URI) {
          id
          title
          content
          seo {
            fullHead
          }
          featuredImage {
            node {
              alt: altText
              imageUrl: sourceUrl
              placeholder: sourceUrl(size: THUMBNAIL)
            }
          }
          designToolsPageContent {
            fieldGroupName
            designToolSections {
              fieldGroupName
              title
              imageGridSection {
                sectionTitle
                descriptionText
                logos {
                  logoName
                  logoImage {
                    alt: altText
                    imageUrl: sourceUrl
                    placeholder: sourceUrl(size: THUMBNAIL)
                  }
                }
              }
              productionSpecsSection {
                specTitle
                specDescription
              }
              colorGridSection {
                colorChartTitle
                colorChart {
                  fieldGroupName
                  colorName
                  colorImage {
                    alt: altText
                    imageUrl: sourceUrl
                    placeholder: sourceUrl(size: THUMBNAIL)
                  }
                }
              }
              secondColorGridSection {
                colorChartTitle
                colorChart {
                  fieldGroupName
                  colorName
                  colorImage {
                    alt: altText
                    imageUrl: sourceUrl
                    placeholder: sourceUrl(size: THUMBNAIL)
                  }
                }
              }
              downloadPdfBox {
                downloadLinkText
                downloadLink {
                  title
                  url
                  target
                }
              }
            }
          }
          customResourcesSection {
            resourcesSection {
              sectionDescription
              sectionTitle
              resources {
                resourceLink {
                  title
                  url
                }
              }
            }
          }
          customCtaSection {
            ctaText
            ctaLink {
              title
              url
            }
            enableCta
          }
        }
      }
    `
  )

  return data
}
