#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "../fragments/cluster_agent.fragment.graphql"

query getAgents(
  $defaultBranchName: String!
  $projectPath: ID!
  $first: Int
  $last: Int
  $afterAgent: String
  $beforeAgent: String
) {
  project(fullPath: $projectPath) {
    id
    clusterAgents(first: $first, last: $last, before: $beforeAgent, after: $afterAgent) {
      nodes {
        ...ClusterAgentFragment
      }

      pageInfo {
        ...PageInfo
      }

      count
    }

    repository {
      tree(path: ".gitlab/agents", ref: $defaultBranchName) {
        trees {
          nodes {
            id
            name
            path
            webPath
          }
        }
      }
    }
  }
}
