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

query getStorageCounter(
  $fullPath: ID!
  $withExcessStorageData: Boolean = false
  $searchTerm: String = ""
  $first: Int!
  $after: String
  $before: String
) {
  namespace(fullPath: $fullPath) {
    id
    name
    storageSizeLimit
    actualRepositorySizeLimit @include(if: $withExcessStorageData)
    additionalPurchasedStorageSize @include(if: $withExcessStorageData)
    totalRepositorySizeExcess @include(if: $withExcessStorageData)
    totalRepositorySize @include(if: $withExcessStorageData)
    containsLockedProjects @include(if: $withExcessStorageData)
    repositorySizeExcessProjectCount @include(if: $withExcessStorageData)
    rootStorageStatistics {
      storageSize
      repositorySize
      lfsObjectsSize
      buildArtifactsSize
      pipelineArtifactsSize
      packagesSize
      wikiSize
      snippetsSize
      uploadsSize
    }
    projects(
      includeSubgroups: true
      search: $searchTerm
      first: $first
      after: $after
      before: $before
      sort: STORAGE
    ) {
      nodes {
        id
        fullPath
        nameWithNamespace
        avatarUrl
        webUrl
        name
        repositorySizeExcess @include(if: $withExcessStorageData)
        actualRepositorySizeLimit @include(if: $withExcessStorageData)
        statistics {
          commitCount
          storageSize
          repositorySize
          lfsObjectsSize
          buildArtifactsSize
          packagesSize
          wikiSize
          snippetsSize
          uploadsSize
        }
      }
      pageInfo {
        ...PageInfo
      }
    }
  }
}
