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

query pipelineStats(
  $firstTotal: Int
  $firstSucceeded: Int
  $firstFailed: Int
  $firstCanceled: Int
  $firstSkipped: Int
  $endCursorTotal: String
  $endCursorSucceeded: String
  $endCursorFailed: String
  $endCursorCanceled: String
  $endCursorSkipped: String
) {
  pipelinesTotal: instanceStatisticsMeasurements(
    identifier: PIPELINES
    first: $firstTotal
    after: $endCursorTotal
  ) {
    nodes {
      ...Count
    }
    pageInfo {
      ...PageInfo
    }
  }
  pipelinesSucceeded: instanceStatisticsMeasurements(
    identifier: PIPELINES_SUCCEEDED
    first: $firstSucceeded
    after: $endCursorSucceeded
  ) {
    nodes {
      ...Count
    }
    pageInfo {
      ...PageInfo
    }
  }
  pipelinesFailed: instanceStatisticsMeasurements(
    identifier: PIPELINES_FAILED
    first: $firstFailed
    after: $endCursorFailed
  ) {
    nodes {
      ...Count
    }
    pageInfo {
      ...PageInfo
    }
  }
  pipelinesCanceled: instanceStatisticsMeasurements(
    identifier: PIPELINES_CANCELED
    first: $firstCanceled
    after: $endCursorCanceled
  ) {
    nodes {
      ...Count
    }
    pageInfo {
      ...PageInfo
    }
  }
  pipelinesSkipped: instanceStatisticsMeasurements(
    identifier: PIPELINES_SKIPPED
    first: $firstSkipped
    after: $endCursorSkipped
  ) {
    nodes {
      ...Count
    }
    pageInfo {
      ...PageInfo
    }
  }
}
