directive @cacheControl(
  maxAge: Int
  scope: CacheControlScope
) on FIELD_DEFINITION | OBJECT | INTERFACE

# A `Lift` is a chairlift, gondola, tram, funicular, pulley, rope tow, or other means of ascending a mountain.
type Lift {
  # The unique identifier for a `Lift` (id: "panorama")
  id: ID!

  # The name of a `Lift`
  name: String!

  # The current status for a `Lift`: `OPEN`, `CLOSED`, `HOLD`
  status: LiftStatus

  # The number of people that a `Lift` can hold
  capacity: Int!

  # A boolean describing whether a `Lift` is open for night skiing
  night: Boolean!

  # The number of feet in elevation that a `Lift` ascends
  elevationGain: Int!

  # A list of trails that this `Lift` serves
  trailAccess: [Trail!]!
}

# A `Trail` is a run at a ski resort
type Trail {
  # A unique identifier for a `Trail` (id: 'hemmed-slacks')
  id: ID!

  # The name of a `Trail`
  name: String!

  # The current status for a `Trail`: OPEN, CLOSED
  status: TrailStatus

  # The difficulty rating for a `Trail`
  difficulty: String!

  # A boolean describing whether or not a `Trail` is groomed
  groomed: Boolean!

  # A boolean describing whether or not a `Trail` has trees
  trees: Boolean!

  # A boolean describing whether or not a `Trail` is open for night skiing
  night: Boolean!

  # A list of Lifts that provide access to this `Trail`
  accessedByLifts: [Lift!]!
}

# An enum describing the options for `LiftStatus`: `OPEN`, `CLOSED`, `HOLD`
enum LiftStatus {
  OPEN
  CLOSED
  HOLD
}

# An enum describing the options for `TrailStatus`: `OPEN`, `CLOSED`
enum TrailStatus {
  OPEN
  CLOSED
}

# This union type returns one of two types: a `Lift` or a `Trail`. When we search for a letter, we'll return a list of either `Lift` or `Trail` objects.
union SearchResult = Lift | Trail

type Query {
  # A list of all `Lift` objects
  allLifts(status: LiftStatus): [Lift!]!

  # A list of all `Trail` objects
  allTrails(status: TrailStatus): [Trail!]!

  # Returns a `Lift` by `id` (id: "panorama")
  Lift(id: ID!): Lift!

  # Returns a `Trail` by `id` (id: "old-witch")
  Trail(id: ID!): Trail!

  # Returns an `Int` of `Lift` objects with optional `LiftStatus` filter
  liftCount(status: LiftStatus): Int!

  # Returns an `Int` of `Trail` objects with optional `TrailStatus` filter
  trailCount(status: TrailStatus): Int!

  # Returns a list of `SearchResult` objects based on `term` or `status`
  search(term: String, status: LiftStatus): [SearchResult!]!
}

type Mutation {
  # Sets a `Lift` status by sending `id` and `status`
  setLiftStatus(id: ID!, status: LiftStatus!): Lift!

  # Sets a `Trail` status by sending `id` and `status`
  setTrailStatus(id: ID!, status: TrailStatus!): Trail!
}

type Subscription {
  # Listens for changes in lift status
  liftStatusChange: Lift!

  # Listens for changes in trail status
  trailStatusChange: Trail!
}

enum CacheControlScope {
  PUBLIC
  PRIVATE
}

# The `Upload` scalar type represents a file upload.
scalar Upload
