extend schema
	@compose(directiveName: "lowercase")
	@compose(directiveName: "uppercase")
	@compose(directiveName: "pascalcase")

"""Caching directive to control cache behavior of fields or fragments."""
directive @cache(
  """Specifies the maximum age for cache in seconds."""
  maxAge: Int!

  """Stale-while-revalidate value in seconds. Optional."""
  swr: Int

  """Scope of the cache. Optional."""
  scope: String
) on OBJECT | INTERFACE | ENUM | UNION | INPUT_OBJECT | FIELD_DEFINITION | INPUT_FIELD_DEFINITION | SCALAR

"""Auth directive to control authorization behavior."""
directive @authenticated(
  """Auth required"""
  required: Boolean!
) on OBJECT | INTERFACE | ENUM | ENUM_VALUE | UNION | INPUT_OBJECT | FIELD_DEFINITION | SCALAR | ARGUMENT_DEFINITION

"""Directive to indicate this is a internal field."""
directive @internal on OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION

"""A repeatable directive."""
directive @repeatable_directive(
  """Service Name required"""
  serviceName: String!
) repeatable on OBJECT | FIELD_DEFINITION

union SearchResult @cache(maxAge: 500, swr: 30) @authenticated(required: true) = Human | Droid | Starship

type Human @cache(maxAge: 60) {
  name: String
  bornIn: String
}

type Droid  @cache(maxAge: 200) {
  """Test Description"""
  name: String @deprecated(reason: "Deprecated use born in") @cache(maxAge: 300, swr: 30)
  primaryFunction: String
}

type Starship  @cache(maxAge: 200) {
  name: String
  length: Int @deprecated(reason: "Use another field") @cache(maxAge: 60)
}

interface Animal  @cache(maxAge: 100) @authenticated(required: true) {
  age: Int!
  kind: Int! @cache(maxAge: 60)
}

type Admin @internal @key {
  name: String
  password: String
}

input HumanInput  @cache(maxAge: 60) @authenticated(required: true) {
  bornIn: String
  """Test Description"""
  name: String @deprecated(reason: "Deprecated use born in") @cache(maxAge: 300, swr: 30)
}

enum TruthEnum  @cache(maxAge: 100) @authenticated(required: true) {
  A @authenticated(required: true)
  B
}

scalar DateNewScalar @cache(maxAge: 500, swr: 30) @authenticated(required: true)

type User  @authenticated(required: true) {
  name: String
  password: String
  price(currency: Int @internal, country: Int @authenticated(required: true) @internal): String
}

type Company  @authenticated(required: true) @repeatable_directive(serviceName: "CompanyService") @repeatable_directive(serviceName: "ProductService") {
  established: Int!
  name: String! @deprecated(reason: "This field is deprecated and will be removed in future") @repeatable_directive(serviceName: "CompanyService Field") @repeatable_directive(serviceName: "ProductService Field")
}

type Query {
  position: Position @deprecated(reason: "unused field")
}

type Position  @cache(maxAge: 100) {
  x: Int!
  y: Int! @cache(maxAge: 60)
}