const entityElementsFromPages = require('./entityElementsForPages.graphql');
const { FIELD_PROMO } = require('./block-fragments/promo.block.graphql');
const {
  FIELD_RELATED_LINKS,
} = require('./paragraph-fragments/listOfLinkTeasers.paragraph.graphql');
const { FIELD_ALERT } = require('./block-fragments/alert.block.graphql');

/**
 * The top-level page for a section of the website.
 * Examples include /health-care/, /disability/, etc.
 */
const ADMIN = '...administration';

// TODO add back fieldTitleIcon
module.exports = `
  
  fragment landingPage on NodeLandingPage {
    ${entityElementsFromPages}
    entityId
    fieldIntroText
    ${FIELD_PROMO}
    ${FIELD_RELATED_LINKS}
    ${FIELD_ALERT}
    fieldSpokes {
      entity {
        ...listOfLinkTeasers
      }
    }    
    fieldSupportServices {          
      ...on FieldNodeFieldSupportServices {            
        entity {      
          entityId
          entityBundle
          ...on NodeSupportService {
            entityId
            entityBundle
            title
            fieldLink {
              url {
                path
              }
              title
              options                  
            }
            fieldPhoneNumber                
          }
        }
      }
    }
    fieldPlainlanguageDate {
      value
      date
    }
    fieldPageLastBuilt {
      date
    }
    changed
    ${ADMIN}
  }
`;

const entityElementsFromPages = require('./entityElementsForPages.graphql');
const { FIELD_PROMO } = require('./block-fragments/promo.block.graphql');
const {
  FIELD_RELATED_LINKS,
} = require('./paragraph-fragments/listOfLinkTeasers.paragraph.graphql');
const { FIELD_ALERT } = require('./block-fragments/alert.block.graphql');

/**
 * The top-level page for a section of the website.
 * Examples include /health-care/, /disability/, etc.
 */
const ADMIN = '...administration';

module.exports = `
  
  fragment landingPage on NodeLandingPage {
    ${entityElementsFromPages}
    entityId
    fieldIntroText
    ${FIELD_PROMO}
    ${FIELD_RELATED_LINKS}
    ${FIELD_ALERT}
    fieldTitleIcon
    fieldSpokes {
      entity {
        ...listOfLinkTeasers
      }
    }    
    fieldSupportServices {          
      ...on FieldNodeFieldSupportServices {            
        entity {      
          entityId
          entityBundle
          ...on NodeSupportService {
            entityId
            entityBundle
            title
            fieldLink {
              url {
                path
              }
              title
              options                  
            }
            fieldPhoneNumber                
          }
        }
      }
    }
    fieldPlainlanguageDate {
      value
      date
    }
    fieldPageLastBuilt {
      date
    }
    changed
    ${ADMIN}
  }
`;

Revert "Remove icon from Drupal query (#9790)" (#9791)