schema
  @link(url: "https://specs.apollo.dev/link/v1.0")
  @link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION) {
  query: Query
}

directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE

directive @join__field(
  graph: join__Graph
  requires: join__FieldSet
  provides: join__FieldSet
  type: String
  external: Boolean
  override: String
  usedOverridden: Boolean
) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION

directive @join__graph(name: String!, url: String!) on ENUM_VALUE

directive @join__implements(
  graph: join__Graph!
  interface: String!
) repeatable on OBJECT | INTERFACE

directive @join__type(
  graph: join__Graph!
  key: join__FieldSet
  extension: Boolean! = false
  resolvable: Boolean! = true
  isInterfaceObject: Boolean! = false
) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR

directive @join__unionMember(
  graph: join__Graph!
  member: String!
) repeatable on UNION

directive @link(
  url: String
  as: String
  for: link__Purpose
  import: [link__Import]
) repeatable on SCHEMA

scalar join__FieldSet

enum join__Graph {
  LABELS @join__graph(name: "labels", url: "http://0.0.0.0:4200/labels")
  PRODUCTS @join__graph(name: "products", url: "http://0.0.0.0:4200/products")
}

scalar link__Import

enum link__Purpose {
  """
  `SECURITY` features provide metadata necessary to securely resolve fields.
  """
  SECURITY

  """
  `EXECUTION` features provide metadata necessary for operation execution.
  """
  EXECUTION
}

scalar JSONBlob @join__type(graph: LABELS) @join__type(graph: PRODUCTS)

interface SearchResult @join__type(graph: LABELS) {
  id: ID! @join__field(graph: LABELS)
}

type LabeledThing implements SearchResult
  @join__type(graph: LABELS)
  @join__implements(graph: LABELS, interface: "SearchResult") {
  id: ID! @join__field(graph: LABELS)
  metadata: JSONBlob @join__field(graph: LABELS)
}

type PlainThing implements SearchResult
  @join__type(graph: LABELS)
  @join__implements(graph: LABELS, interface: "SearchResult") {
  id: ID! @join__field(graph: LABELS)
  catalog: Catalog @join__field(graph: LABELS)
  title: String @join__field(graph: LABELS)
}

type Product
  @join__type(graph: LABELS, key: "id")
  @join__type(graph: PRODUCTS, key: "id") {
  id: ID!
  metadata: JSONBlob
    @join__field(graph: LABELS, external: true)
    @join__field(graph: PRODUCTS)
}

type Catalog @join__type(graph: LABELS) {
  metadata: JSONBlob @join__field(graph: LABELS)
  metadataList: [JSONBlob!]! @join__field(graph: LABELS)
}

type Query @join__type(graph: LABELS) @join__type(graph: PRODUCTS) {
  labels: JSONBlob @join__field(graph: LABELS)
  labelsArray: JSONBlob @join__field(graph: LABELS)
  labelsText: JSONBlob @join__field(graph: LABELS)
  labelsNumber: JSONBlob @join__field(graph: LABELS)
  labelsBool: JSONBlob @join__field(graph: LABELS)
  labelsNull: JSONBlob @join__field(graph: LABELS)
  catalog: Catalog @join__field(graph: LABELS)
  abstractThing: SearchResult @join__field(graph: LABELS)
  abstractThings: [SearchResult!]! @join__field(graph: LABELS)
  productRef(id: ID!): Product @join__field(graph: LABELS)
  product(id: ID!): Product @join__field(graph: PRODUCTS)
}
