schema
    @link(url: "https://specs.apollo.dev/link/v1.0")
    @link(url: "https://specs.apollo.dev/cacheTag/v0.1", for: EXECUTION)
    @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__directive(
    graphs: [join__Graph!]
    name: String!
    args: join__DirectiveArguments
) repeatable on SCHEMA | OBJECT | INTERFACE | FIELD_DEFINITION

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
scalar join__DirectiveArguments
scalar link__Import

enum join__Graph {
    STUFF @join__graph(name: "stuff", url: "http://localhost:4001")
    STATUS @join__graph(name: "status", url: "http://localhost:4002")
}

enum link__Purpose {
    SECURITY
    EXECUTION
}

type Query @join__type(graph: STUFF) @join__type(graph: STATUS) {
    getStatus(id: String!): Status @join__field(graph: STUFF)
}

type Status
    @join__type(graph: STUFF, key: "id items { id name }")
    @join__type(graph: STATUS, key: "id items { id name }")
    @join__directive(
        graphs: [STATUS]
        name: "federation__cacheTag"
        args: { format: "status-{$key.id}-{$key.name}" }
    ) {
    id: String!
    items: [Item]!
    stuffDetails: String @join__field(graph: STUFF)
    statusDetails: String @join__field(graph: STATUS)
}

type Item @join__type(graph: STUFF) @join__type(graph: STATUS) {
    id: String!
    # NOTE: intentionally nullable
    name: String
}
