# The Query type represents the read entry points into the API.
type Query {
  # Find character by either an ID or a nick.
  character(id: String, nick: String): Character

  # Find characters by either a list of ids, nicks or an author. Only one parameter at a time
  characters(ids: [String!], nicks: [String!], author: String): [Character!]!
  

  # Find channel by name
  channel(name: String!): Channel

  # Find all channels. Specifying `logged: true` restricts the search to only logged.
  channels(logged: Boolean): [Channel!]!  
  

  # Find log by ID
  log(id: String): Log

  # Find logs by a list of IDs
  logs(input: LogQueryInput): [LogHeader!]!


  # Find post by ID
  post(id: String!): Post

  # Find posts by IDs. It's meant to allow other parts of the UI to link to a cluster of posts, e.g. for a room description for the
  # Mapp should it ever become a thing.
  posts(ids: [String!]!): [Post!]!


  # Find file by ID
  file(id: String!): File

  # Files get all available files. If includePublic is set, it will return public files as well
  files(includePublic: Boolean, mimeTypes: [String!]): [File!]!


  # Find current session
  session: Session!
}

# The Mutation type represents write entry points into the API.
type Mutation {
  # Add a new character
  addCharacter(input: CharacterAddInput!): Character!

  # Add nick to character
  addCharacterNick(input: CharacterNickInput!): Character!
  
  # Remove nick from character
  removeCharacterNick(input: CharacterNickInput!): Character!

  # Edit character
  editCharacter(input: CharacterEditInput!): Character!

  # Remove a character
  removeCharacter(id: String!): Character!


  # Add a channel
  addChannel(input: ChannelAddInput!): Channel!

  # Edit a channel
  editChannel(input: ChannelEditInput!): Channel!

  # Remove a channel
  removeChannel(name: String!): Channel!


  # Add a new log
  addLog(input: LogAddInput!): Log!

  # Edit a log
  editLog(input: LogEditInput!): Log!

  # Remove a log
  removeLog(id: String!): Log!


  # Add a post
  addPost(input: AddPostInput!): Post!

  # Edit a post
  editPost(input: EditPostInput!): Post!

  # Move a post
  movePost(input: MovePostInput!): Post!

  # Remove a post
  removePost(id: String!): Post!


  # Edit a file
  editFile(input: EditFileInput!): File!

  # Remove a file
  removeFile(id: String!): File


  # Log in
  login(username: String!, password: String!): Session!
  
  # Log out
  logout(): Session!
}

schema { 
  query: Query
  mutation: Mutation
}