import { gql } from 'graphql-request'

export const PRODUCT_PAGE_FRAGMENT = gql`
  fragment ProductPageFields on Page {
    title
    seo {
      fullHead
    }
    featuredImage {
      node {
        imageUrl: sourceUrl
        alt: altText
        placeholder: sourceUrl(size: THUMBNAIL)
      }
    }
    productPageContent {
      mainHeroSection {
        fieldGroupName
        productLabel
        heroTitle
        heroText
        subHeroTitle
        subHeroText
      }
      keyFeatureSliders {
        sliderTitle
        sliderText
        sliderButtonLink {
          title
          url
        }
        sliderImages {
          imageSlide {
            alt: altText
            imageUrl: sourceUrl
            placeholder: sourceUrl(size: THUMBNAIL)
          }
          imageCaption
        }
      }
      pullQuoteSection {
        fieldGroupName
        enablePullquote
        quoteText
        quoteName
        quoteTitle
        quoteCompany
        enableQuoteButton
        buttonLink {
          title
          url
        }
      }
      productStyles: imageGridSection {
        fieldGroupName
        sectionTitle
        descriptionText
        logos {
          logoName
          logoImage {
            altText
            sourceUrl
          }
        }
      }
      pdfDownloadSection {
        fieldGroupName
        enablePdfSection
        copyText
        pdfUrl
      }
      threeImageGridSection {
        fieldGroupName
        enableGridImageSection
        largeImagePlacement
        photoGrid {
          fieldGroupName
          image {
            alt: altText
            imageUrl: sourceUrl
            placeholder: sourceUrl(size: THUMBNAIL)
          }
        }
        removePadding
      }
      designOptionsSection: threeColumnSection {
        fieldGroupName
        sectionTitle
        columns {
          columnTitle
          columnDescriptionText
          buttonLink {
            title
            url
          }
        }
      }
      fullImageSection {
        enableFullImage
        image: fullImage {
          alt: altText
          imageUrl: sourceUrl
          placeholder: sourceUrl(size: THUMBNAIL)
        }
      }
      useCasesSection {
        useCasesDescription
        productType {
          name
          slug
          uri
          projects(first: 6) {
            nodes {
              uri
              id
              title
              caseStudyProjectContent {
                heroSection {
                  customerName
                  projectType
                }
              }
              productIndustries {
                nodes {
                  name
                }
              }
              featuredImage {
                node {
                  alt: altText
                  imageUrl: sourceUrl
                  placeholder: sourceUrl(size: THUMBNAIL)
                }
              }
            }
          }
        }
      }
      featuredCaseStudySection {
        enableFeaturedCaseStudy
        caseStudyLogo {
          alt: altText
          imageUrl: sourceUrl
          placeholder: sourceUrl(size: THUMBNAIL)
        }
        introCopy
        featuredCaseStudy {
          ... on CaseStudy {
            featuredImage {
              node {
                alt: altText
                imageUrl: sourceUrl
                placeholder: sourceUrl(size: THUMBNAIL)
              }
            }
            uri
          }
        }
      }
      crossSellSection {
        leftProduct {
          productCategoryLabel
          productTypeName
          productLink {
            ... on Page {
              id
              url: uri
            }
            ... on Project {
              id
              url: uri
            }
            ... on CaseStudy {
              id
              url: uri
            }
          }
          productImage {
            alt: altText
            imageUrl: sourceUrl
            placeholder: sourceUrl(size: THUMBNAIL)
          }
        }
        rightProduct {
          productCategoryLabel
          productTypeName
          productImage {
            alt: altText
            imageUrl: sourceUrl
            placeholder: sourceUrl(size: THUMBNAIL)
          }
          productLink {
            ... on Page {
              id
              url: uri
            }
            ... on Project {
              id
              url: uri
            }
            ... on CaseStudy {
              id
              url: uri
            }
          }
        }
      }
      customCtaSection {
        accentColor
        ctaText
        ctaLink {
          title
          url
        }
        enableCta
      }
    }
  }
`
