import { gql } from 'graphql-request'

export const MATERIALS_FRAGMENT = gql`
  fragment MaterialsPageFragment on Page {
    title
    content
    seo {
      fullHead
    }
    featuredImage {
      node {
        alt: altText
        imageUrl: sourceUrl
        placeholder: sourceUrl(size: THUMBNAIL)
      }
    }
    materialsPageContent {
      fieldGroupName
      heroSection {
        heroTitle
        heroText
      }
      materialsTitle
      materialsDescription
      materialsSections {
        title
        description
        enableDescriptionButton
        buttonLink {
          title
          url
        }
        bodySection {
          ... on Page_Materialspagecontent_materialsSections_BodySection_3ColPhotosLayout {
            fieldGroupName
            photoGrid {
              image {
                alt: altText
                imageUrl: sourceUrl
                placeholder: sourceUrl(size: THUMBNAIL)
              }
            }
          }
          ... on Page_Materialspagecontent_materialsSections_BodySection_AsymmetricalPhotoLayout {
            fieldGroupName
            largeImagePlacement
            photoGrid {
              image {
                alt: altText
                imageUrl: sourceUrl
                placeholder: sourceUrl(size: THUMBNAIL)
              }
            }
          }
          ... on Page_Materialspagecontent_materialsSections_BodySection_FullWidthPhotoLayout {
            fieldGroupName
            image {
              alt: altText
              imageUrl: sourceUrl
              placeholder: sourceUrl(size: THUMBNAIL)
            }
          }
        }
        specificationsTitle
        productionSpecsSection {
          specTitle
          specDescription
        }
        downloadPdfSection {
          downloadPdfText
          downloadPdfLink {
            title
            url
          }
        }
      }
    }
    customResourcesSection {
      resourcesSection {
        resources {
          resourceLink {
            title
            url
          }
        }
        sectionDescription
        sectionTitle
      }
    }
    customCtaSection {
      enableCta
      ctaText
      ctaLink {
        url
        title
      }
    }
  }
`

export const MATERIALS_MENU_FRAGMENT = gql`
  fragment MaterialsMenuFragment on Menu {
    name
    menuItems {
      nodes {
        label
        cssClasses
        path
      }
    }
  }
`
