fragment StorageBucketDetails on StorageBucket {
  id
  operatorMetadata {
    id
    nodeEndpoint
  }
  operatorStatus {
    ... on StorageBucketOperatorStatusActive {
      workerId
    }
    ... on StorageBucketOperatorStatusInvited {
      workerId
    }
  }
}

query getStorageBucketDetails($offset: Int, $limit: Int) {
  storageBuckets(offset: $offset, limit: $limit) {
    ...StorageBucketDetails
  }
}

fragment StorageBagDetails on StorageBag {
  id
  storageAssignments {
    storageBucket {
      id
    }
  }
}

query getStorageBagDetails($bucketIds: [String!], $offset: Int, $limit: Int) {
  storageBags(offset: $offset, limit: $limit, where: { storageAssignments_some: { storageBucketId_in: $bucketIds } }) {
    ...StorageBagDetails
  }
}

fragment DataObjectDetails on StorageDataObject {
  id
  storageBagId
}

query getDataObjectDetails($bagIds: StorageBagWhereInput, $offset: Int, $limit: Int) {
  storageDataObjects(offset: $offset, limit: $limit, where: { storageBag: $bagIds, isAccepted_eq: true }) {
    ...DataObjectDetails
  }
}
