import { gql } from 'graphql-request'

export const SOCIAL_LINKS_FRAGMENT = gql`
  fragment SocialLinkFields on AcfOptionsSocial {
    themeSettingsSocial {
      facebook
      instagram
      linkedin
      pinterest
      twitter
    }
  }
`

export const THEME_SETTINGS_FRAGMENT = gql`
  fragment LinkFields on AcfLink {
    target
    title
    url
  }
  fragment GlobalSettingsFields on AcfOptionsThemeSettings {
    globalSettings {
      address
      contactEmail
      fax
      phone1
      phone2
      privacyPolicy {
        ...LinkFields
      }
      termsOfUse {
        ...LinkFields
      }
    }
  }
`

export const SETTINGS_FRAGMENT = gql`
  fragment SettingsFields on GeneralSettings {
    dateFormat
    description
    language
    timeFormat
    title
  }
`

export const MENU_FRAGMENT = gql`
  fragment MenuFields on Menu {
    menuItems(first: 10000) {
      nodes {
        id
        path
        label
        linkRelationship
        target
        parentId
        childItems {
          nodes {
            id
            path
            cssClasses
            label
            linkRelationship
            target
            parentId
            childItems {
              nodes {
                id
                path
                cssClasses
                label
                linkRelationship
                target
                parentId
              }
            }
          }
        }
      }
    }
  }
`
