schema {
  query: Query
}

enum Episode {
  NEW_HOPE
  EMPIRE
  JEDI
}

"A character in the Star Wars Trilogy"
interface Character {
  "The id of the character"
  id: String!
  "The name of the character"
  name: String
  "The friends of the character"
  friends: [Character!]!
  "Which movies they appear in"
  appearsIn: [Episode!]!
}

"A mechanical creature in the Star Wars universe."
type Droid implements Character {
  "The id of the droid"
  id: String!
  "The name of the droid"
  name: String
  "The friends of the droid"
  friends: [Character!]!
  "Which movies they appear in"
  appearsIn: [Episode!]!
  "The primary function of the droid"
  primaryFunction: String
}

"A humanoid creature in the Star Wars universe."
type Human implements Character {
  "The id of the human"
  id: String!
  "The name of the human"
  name: String
  "The friends of the human"
  friends: [Character!]!
  "Which movies they appear in"
  appearsIn: [Episode!]!
  "The home planet of the human"
  homePlanet: String
}

"The root query object of the schema"
type Query {
  human("id of the human" id: String!): Human
  droid("id of the droid" id: String!): Droid
  hero("If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode" episode: Episode): Character
}
