import { gql } from '@apollo/client'

// Query for getting all regions
export const GET_REGIONS = gql`
  query GetRegions {
    regions {
      id
      name
      code
      country
      coordinates {
        latitude
        longitude
      }
      sites {
        id
        name
      }
      clusters {
        id
        name
      }
    }
  }
`

// Query for getting a specific region
export const GET_REGION = gql`
  query GetRegion($id: ID!) {
    region(id: $id) {
      id
      name
      code
      country
      coordinates {
        latitude
        longitude
      }
      sites {
        id
        name
        clusters {
          id
          name
        }
      }
      clusters {
        id
        name
        nodes {
          id
          name
          health
        }
      }
    }
  }
`

// Query for getting resources
export const GET_RESOURCES = gql`
  query GetResources($filter: ResourceFilter) {
    resources(filter: $filter) {
      id
      name
      type
      region {
        id
        name
      }
      health
      metadata
    }
  }
`

// Query for getting network topology
export const GET_NETWORK_TOPOLOGY = gql`
  query GetNetworkTopology($regionId: ID) {
    networkTopology(regionId: $regionId) {
      nodes {
        id
        name
        type
        position {
          x
          y
          z
        }
        health
      }
      edges {
        id
        from
        to
        type
        latency
        bandwidth
        status
      }
    }
  }
`

