directive @_filterEmails(archived: Boolean!, received: Boolean!, sent: Boolean!) on FIELD

union ActionLogDetails = CustomInjectDetailsType | EmailType | InjectDetailsType | QuestionnaireType | ToolDetailsType

type ActionLogType {
  channel: DefinitionChannelType!
  details: ActionLogDetails!
  id: ID!
  readReceipt: DateTime
  requiresAttention: Boolean!
  team: TeamType!
  teamId: ID!
  timestamp: DateTime!
  todo: Boolean!
  type: LogType!
}

type ActionLogsSubscription {
  actionLog: ActionLogType!
  eventType: EventType!
}

type AddDefinitionAccessMutation {
  operationDone: Boolean!
}

type AnalyticsActionLogsSubscription {
  actionLog: ActionLogType!
  eventType: EventType!
}

type AnalyticsEmailThreadSubscription {
  emailThread: EmailThreadType!
}

type AnalyticsMilestonesSubscription {
  milestones: [MilestoneStateType!]!
}

input AnswerInput {
  questionId: ID!

  """
  Answer to the specific question, in case of `RADIO` type question, it is the string representation of the numeric position of the selected option, 1-based
  """
  value: String!
}

type AnswerQuestionnaireMutation {
  operationDone: Boolean!
}

type AnswerType {
  questionId: ID!

  """
  Answer to the specific question, in case of `RADIO` type question, it is the string representation of the numeric position of the selected option, 1-based
  """
  value: String!
}

type AssignInstructorsToExercise {
  operationDone: Boolean!
}

type AssignUsersByTags {
  operationDone: Boolean!
}

type AssignUsersEqually {
  operationDone: Boolean!
}

type AssignUsersToTeamMutation {
  operationDone: Boolean!
}

"""An enumeration."""
enum AuthGroup {
  ADMIN
  INSTRUCTOR
  TRAINEE
}

type ChangeUserDataMutation {
  user: UserType!
}

input ChangeUserInput {
  active: Boolean
  group: AuthGroup
  userId: UUID!
}

type ChangeUserType {
  active: Boolean
  group: AuthGroup
  userId: UUID!
}

type ChannelReceipt {
  id: ID!
  isUnread: Boolean
  teamId: ID!
}

"""An enumeration."""
enum ChannelType {
  """Email"""
  EMAIL

  """Form"""
  FORM

  """Info"""
  INFO

  """Tool"""
  TOOL
}

input ConfigOverrideInput {
  customEmailSuffix: String
  customTeamNames: [String!] = []
  emailBetweenTeams: Boolean
  exerciseDuration: Int
  showExerciseTime: Boolean
}

type ConfigOverrideType {
  customEmailSuffix: String
  customTeamNames: [String!]
  emailBetweenTeams: Boolean
  exerciseDuration: Int
  showExerciseTime: Boolean
}

type ConfirmActionMutation {
  actionLog: ActionLogType!
}

type ConfirmationType {
  control: ControlType!
  id: ID!
  text: String!
}

type ContentType {
  fileInfo: FileInfoType
  id: ID!
  raw: String!
  rendered: String!
}

type ControlType {
  activateMilestone: String!
  deactivateMilestone: String!
  id: ID!
  milestoneCondition: String!
  roles: String!
}

type ControlsMapType {
  choice: Int!
  control: ControlType!
}

type CopyUsersAssignment {
  operationDone: Boolean!
}

input CreateExerciseInput {
  configOverride: ConfigOverrideInput
  definitionId: ID!
  name: String = ""
  teamCount: Int!
}

type CreateExerciseMutation {
  exercise: ExerciseType!
}

type CreateExerciseType {
  configOverride: ConfigOverrideType
  definitionId: ID!
  name: String
  teamCount: Int!
}

type CreateTagMutation {
  newTag: TagType!
}

type CreateThreadMutation {
  thread: EmailThreadType!
}

input CreateUserInput {
  email: String!
  firstName: String = ""
  group: AuthGroup
  lastName: String = ""
  tags: [String!]! = []
}

type CreateUserMutation {
  newUser: RestrictedUser!
}

type CreateUserType {
  email: String!
  firstName: String
  group: AuthGroup
  lastName: String
  tags: [String!]!
}

type CustomInjectDetailsType {
  content: ContentType!
  id: ID!
  overlay: OverlayType
  user: RestrictedUser
}

input CustomInjectInput {
  channelId: ID!
  content: String!
  exerciseId: ID!
  fileId: UUID
  overlay: OverlayInput
  teamIds: [ID]!
}

type CustomInjectType {
  channelId: ID!
  content: String!
  exerciseId: ID!
  fileId: UUID
  overlay: OverlayType
  teamIds: [ID]!
}

"""
The `DateTime` scalar type represents a DateTime
value as specified by
[iso8601](https://en.wikipedia.org/wiki/ISO_8601).
"""
scalar DateTime

type DefinitionChannelType {
  definition: DefinitionType!
  description: String!
  displayName: String!
  id: ID!
  name: String!
  readReceipt: [ChannelReceipt!]!
  type: ChannelType!
}

type DefinitionInjectType {
  delay: Int!
  id: ID!
  name: String!
  organization: String!
  target: DefinitionChannelType!
  time: Int!
  type: InjectType!
}

type DefinitionRoleType {
  definition: DefinitionType!
  description: String!
  displayName: String!
  id: ID!
  name: String!
}

type DefinitionType {
  addresses: [EmailAddressType!]!
  channels: [DefinitionChannelType!]!
  description: String!
  exercises: [ExerciseType!]!
  files: [FileInfoType!]!
  id: ID!
  injects: [DefinitionInjectType!]!
  learningObjectives: [LearningObjectiveType!]!
  maintainers: [RestrictedUser!]!
  name: String!
  prerequisites: [String!]!
  questionnaires: [QuestionnaireType!]!
  roles: [DefinitionRoleType!]!
  targetAudience: String!
  timestampCreated: DateTime!
  tools: [ToolType!]!
  uploadedBy: RestrictedUser
  version: String!
}

type DeleteDefinitionMutation {
  definitionId: ID!
  exerciseIds: [ID!]!
  operationDone: Boolean!
  teamIds: [ID!]!
}

type DeleteExerciseMutation {
  exerciseId: ID!
  operationDone: Boolean!
  teamIds: [ID!]!
}

type DeleteTagsMutation {
  operationDone: Boolean!
  tagIds: [ID!]!
}

type DeleteUsersMutation {
  operationDone: Boolean!
  userIds: [ID!]!
}

type EmailAddressType {
  address: String!
  control: ControlType!
  definition: ExerciseDefinitionType!
  description: String!
  id: ID!
  organization: String!
  teamVisible: Boolean!
  templates: [EmailTemplateType!]!
}

input EmailDraftInput {
  activateMilestone: String
  content: String
  deactivateMilestone: String
  emailThreadId: String
  fileId: UUID
  instructor: Boolean!
  selectedContacts: [String]
  senderAddress: String
  subject: String
  teamId: String!
  templateId: String
}

type EmailDraftType {
  activateMilestone: String
  content: String
  deactivateMilestone: String
  emailThreadId: String
  fileId: UUID
  instructor: Boolean!
  selectedContacts: [String]
  senderAddress: String
  subject: String
  teamId: String!
  templateId: String
}

type EmailParticipantType {
  address: String!
  definitionAddress: EmailAddressType
  emails: [EmailType!]!
  exercise: ExerciseType!
  id: ID!
  team: TeamType
  threads: [EmailThreadType!]!
}

type EmailReceipt {
  emailId: ID!
  readReceipt: DateTime
}

type EmailTemplateType {
  content: ContentType!
  context: String!
  control: ControlType!
  id: ID!
  sender: String!
  subject: String!
}

type EmailThreadReceipt {
  isUnread: Boolean
  teamId: ID!
  threadId: ID!
}

type EmailThreadSubscription {
  emailThread: EmailThreadType!
}

type EmailThreadType {
  archived: Boolean!
  emails: [EmailType!]!
  exercise: ExerciseType!
  id: ID!
  lastEmail: EmailType
  participants: [EmailParticipantType!]!
  readReceipt: [EmailThreadReceipt!]!
  subject: String!
  timestamp: DateTime!
}

type EmailType {
  content: ContentType!
  id: ID!
  overlay: OverlayType
  readReceipt: DateTime
  sender: EmailParticipantType!
  thread: EmailThreadType!
  timestamp: DateTime!
  todo: Boolean!
  user: RestrictedUser
}

"""An enumeration."""
enum EventType {
  CREATE
  DELETE
  MODIFY
}

type ExerciseDefinitionType {
  id: ID!
  name: String!
}

type ExerciseLoopRunningSubscription {
  exerciseLoopRunning: Boolean!
}

type ExerciseType {
  createdBy: RestrictedUser
  definition: ExerciseDefinitionType!
  elapsedS: Int!
  emailParticipants: [EmailParticipantType!]!
  exerciseStart: DateTime
  finished: Boolean!
  id: ID!
  instructors: [RestrictedUser!]!
  name: String!
  running: Boolean!
  teams: [TeamType!]!
  threads: [EmailThreadType!]!
  timestampCreated: DateTime!
  uuid: UUID!
}

type ExercisesSubscription {
  eventType: EventType!
  exercise: ExerciseType!
}

type ExtendedToolType {
  category: String!
  defaultResponse: String!
  definition: ExerciseDefinitionType
  hint: String!
  id: ID!
  name: String!
  responses: [ToolResponseType!]!
  roles: String!
  tooltipDescription: String!
}

type FileInfoType {
  definition: DefinitionType
  fileName: String!
  id: UUID!
}

input FilterUsersInput {
  active: Boolean
  firstName: String
  groups: [AuthGroup]
  imported: Boolean
  lastName: String
  limit: Int
  skip: Int
  tags: [String]
  username: String
}

type FilterUsersType {
  active: Boolean
  firstName: String
  groups: [AuthGroup]
  imported: Boolean
  lastName: String
  limit: Int
  skip: Int
  tags: [String]
  username: String
}

type FreeFormQuestionDetailsType {
  definition: ExerciseDefinitionType!
  id: ID!
  multiline: Boolean!
  relatedMilestones: [MilestoneType!]!
}

type GrapheneConfig {
  customEmailSuffix: String
  emailBetweenTeams: Boolean
  enableRoles: Boolean
  exerciseDuration: Int
  showExerciseTime: Boolean
}

type InjectDetailsType {
  confirmation: ConfirmationType
  confirmed: Boolean
  confirmedBy: RestrictedUser
  content: ContentType!
  id: ID!
  inject: DefinitionInjectType!
  overlay: OverlayType
  timestampConfirmed: DateTime
}

"""An enumeration."""
enum InjectType {
  """Email"""
  EMAIL

  """Form"""
  FORM

  """Info"""
  INFO

  """Tool"""
  TOOL
}

type LearningActivityType {
  description: String!
  id: ID!
  milestones: [MilestoneType!]!
  name: String!
  objective: LearningObjectiveType!
  tags: String!
}

type LearningObjectiveType {
  activities: [LearningActivityType!]!
  definition: DefinitionType!
  description: String!
  id: ID!
  name: String!
  order: Int!
  tags: String!
}

"""An enumeration."""
enum LogType {
  CUSTOM_INJECT
  EMAIL
  FORM
  INJECT
  TOOL
}

type MilestoneStateHistoryType {
  id: ID!
  reached: Boolean!
  timestampFrom: DateTime!
}

type MilestoneStateType {
  activity: TeamLearningActivityType
  history: [MilestoneStateHistoryType!]!
  id: ID!
  milestone: MilestoneType!
  reached: Boolean!
  teamIds: [ID!]!
  timestampReached: DateTime
}

type MilestoneType {
  activity: LearningActivityType
  description: String!
  displayName: String!
  fileNames: String!
  final: Boolean!
  id: ID!
  initialState: Boolean!
  name: String!
  roles: String!
  tags: [String!]!
  teamVisible: Boolean!
}

type MilestonesSubscription {
  milestones: [MilestoneStateType!]!
}

type ModifyMilestoneMutation {
  operationDone: Boolean!
}

type MoveExerciseTimeMutation {
  exercise: ExerciseType!
}

type Mutation {
  """Mutation for granting access to the specific definition"""
  addDefinitionAccess(
    """ID of the definition to which instructors (users) are granted access"""
    definitionId: ID!

    """IDs of the instructors (users) to be granted access to definition"""
    userIds: [ID]!
  ): AddDefinitionAccessMutation

  """Mutation for answering questionnaires"""
  answerQuestionnaire(questInput: QuestionnaireInput!): AnswerQuestionnaireMutation

  """Mutation for assigning instructors (users) to the exercise"""
  assignInstructorsToExercise(
    """ID of the exercise to which instructors (users) are being assigned"""
    exerciseId: ID!

    """IDs of the instructors (users) to be assigned to an exercise"""
    userIds: [ID]!
  ): AssignInstructorsToExercise

  """Mutation for assigning users to the teams by tags"""
  assignUsersByTags(
    """ID of the exercise to which users are being assigned"""
    exerciseId: ID!

    """
    Prefix of the tag that holds information about the user assignments to teams
    """
    tagPrefix: String!

    """IDs of the users being assigned to exercise"""
    userIds: [ID!]!
  ): AssignUsersByTags

  """Mutation for assigning users to the exercise equally if possible"""
  assignUsersEqually(
    """ID of the exercise to which users are being assigned"""
    exerciseId: ID!

    """IDs of the users being assigned"""
    userIds: [ID!]!
  ): AssignUsersEqually

  """Mutation for assigning users to the specific team of the exercise"""
  assignUsersToTeam(
    """ID of the team to which users are being assigned"""
    teamId: ID!

    """IDs of the users to be assigned to team"""
    userIds: [ID]!
  ): AssignUsersToTeamMutation

  """Mutation for changing user data"""
  changeUserData(changeUserInput: ChangeUserInput!): ChangeUserDataMutation

  """Mutation for confirming actions"""
  confirmAction(logId: ID!, teamId: ID!): ConfirmActionMutation

  """Mutation for copying users assignments from one exercise to another"""
  copyUsersAssignment(
    """ID of the exercise from which the assignments of users will be copied"""
    fromExerciseId: ID!

    """ID of the exercise to which the assignments of users will be copied"""
    toExerciseId: ID!
  ): CopyUsersAssignment

  """Mutation that creates a new exercise with given definition by its id"""
  createExercise(createExerciseInput: CreateExerciseInput!): CreateExerciseMutation

  """Mutation for creating a tag"""
  createTag(name: String!): CreateTagMutation

  """Mutation for creating a new thread"""
  createThread(
    exerciseId: ID!

    """List of email addresses that should be included in the thread"""
    participantAddresses: [String]!

    """The subject of the thread"""
    subject: String!
  ): CreateThreadMutation

  """Mutation for creating a user"""
  createUser(createUserInput: CreateUserInput!): CreateUserMutation

  """Mutation that deletes a definition of given id"""
  deleteDefinition(definitionId: ID!): DeleteDefinitionMutation
  deleteEmailDraft(emailThreadId: ID, instructor: Boolean!, teamId: ID!): MutationResult

  """Mutation that deletes an exercise of given id"""
  deleteExercise(exerciseId: ID!): DeleteExerciseMutation

  """Mutation for deleting a tag"""
  deleteTags(
    """If true, will delete tags even if they are assigned to users"""
    force: Boolean = false
    tagIds: [ID!]!
  ): DeleteTagsMutation

  """Mutation for deleting users"""
  deleteUsers(
    """IDs of the users to be deleted"""
    userIds: [ID]!
  ): DeleteUsersMutation

  """Mutation for instructors to modify a team's milestone state"""
  modifyMilestone(
    """Activate or deactivate the provided milestone, activates by default"""
    activate: Boolean = true
    milestone: String!
    teamId: ID!
  ): ModifyMilestoneMutation

  """
  Mutation for moving the in-exercise time by the specified amount of minutes
  """
  moveTime(exerciseId: ID!, timeDiff: Int!): MoveExerciseTimeMutation

  """Mutation for changing a user's password"""
  passwordChange(newPassword: String!, newPasswordRepeat: String!, oldPassword: String!): PasswordChange

  """Mutation for re-generating credentials for users"""
  regenerateCredentials(
    """IDs of the users to have re-generated credentials"""
    userIds: [ID]!
  ): RegenerateCredentialsMutation
  reloadDefinitions: MutationResult
  reloadExercises: MutationResult
  reloadTable: MutationResult

  """Mutation for removing access of instructors (users) to the definition"""
  removeDefinitionAccess(
    """ID of the definition from which instructors (users) are being removed"""
    definitionId: ID!

    """IDs of the users to be removed from a definition access"""
    userIds: [ID]!
  ): RemoveDefinitionAccessMutation

  """Mutation for removing instructors (users) from the exercise"""
  removeInstructorsFromExercise(
    """ID of the exercise from which instructors (users) are being removed"""
    exerciseId: ID!

    """IDs of the users to be removed from the exercise"""
    userIds: [ID]!
  ): RemoveInstructorsFromExerciseMutation

  """Mutation for removing users from the specific team of the exercise"""
  removeUsersFromTeam(
    """ID of the team from which users are being removed"""
    teamId: ID!

    """IDs of the users to be removed from a team"""
    userIds: [ID]!
  ): RemoveUsersFromTeamMutation

  """Mutation for reviewing questionnaires"""
  reviewQuestionnaire(reviewInput: QuestionnaireReviewInput!): ReviewQuestionnaireMutation

  """Mutation for sending custom injects"""
  sendCustomInject(customInjectInput: CustomInjectInput!): SendCustomInjectMutation

  """Mutation for sending an email"""
  sendEmail(sendEmailInput: SendEmailInput!): SendEmailMutation
  setArchiveEmail(emailThreadId: ID!, state: Boolean!): MutationResult
  setEmailDraft(emailDraft: EmailDraftInput!): EmailDraftType
  setEmailTodo(emailId: ID!, state: Boolean!): MutationResult
  setIsUnreadChannel(channelId: ID!, isUnread: Boolean!, teamId: ID!): MutationResult
  setIsUnreadEmailThread(isUnread: Boolean!, teamId: ID!, threadId: ID!): MutationResult
  setTeamQuestionnaireTodo(questionnaireId: ID!, state: Boolean!, teamId: ID!): MutationResult
  setTodoActionLog(actionLogId: ID!, state: Boolean!): MutationResult @deprecated

  """Mutation for starting the specified exercise"""
  startExercise(exerciseId: ID!): StartExerciseMutation

  """Mutation that stops an exercise of given id"""
  stopExercise(exerciseId: ID!): StopExerciseMutation

  """Mutation for updating a tag"""
  updateTag(newName: String!, tagId: ID!): UpdateTagMutation

  """Mutation for changing tag assignments"""
  updateTagAssignments(updateTagAssignmentsInput: UpdateTagAssignmentsInput!): UpdateTagAssignmentsMutation

  """Mutation for performing a tool action"""
  useTool(useToolInput: UseToolInput!): UseToolMutation
  writeReadReceipt(actionLogId: ID!): ReadReceiptType
  writeReadReceiptEmail(emailId: ID!): EmailReceipt
}

type MutationResult {
  operationDone: Boolean
}

input OverlayInput {
  duration: Int!
}

type OverlayType {
  duration: Int!
  id: ID!
}

type PasswordChange {
  passwordChanged: Boolean!
}

type Query {
  """Retrieve action log with given id"""
  actionLog(logId: ID!): ActionLogType!

  """
  Retrieve all action logs for the specific exercise with optional ordering. Useful for analytics.
  """
  analyticsActionLogs(exerciseId: ID!, newestFirst: Boolean = false): [ActionLogType!]!

  """
  Retrieve all email threads for the specific exercise. Useful for analytics.
  """
  analyticsEmailThreads(exerciseId: ID!): [EmailThreadType!]!

  """
  Retrieve all milestones for the specific exercise. Useful for analytics.
  """
  analyticsMilestones(exerciseId: ID!): [MilestoneStateType!]!

  """Retrieve a specific channel"""
  channel(channelId: ID!): DefinitionChannelType!

  """Retrieve a specific definition"""
  definition(definitionId: ID!): DefinitionType!

  """Retrieve all definitions"""
  definitions: [DefinitionType!]!

  """
  Retrieve the instructor email addresses from the specified email thread
  """
  emailAddresses(threadId: ID!): [String!]!

  """Retrieve the specific email participant"""
  emailContact(participantId: ID!): EmailParticipantType!

  """Retrieve all email contacts for the running exercise"""
  emailContacts(
    """
    Not required, defaults to true returns only milestones that are visible to the team.
                If set to false then all milestones (even not visible to team) are sent
    """
    visibleOnly: Boolean
  ): [EmailParticipantType!]!

  """
  Retrieve all email templates for the specified exercise and email addresses
  """
  emailTemplates(emailAddresses: [String]!, exerciseId: ID!): [EmailTemplateType!]!

  """Retrieve the specific email thread"""
  emailThread(threadId: ID!): EmailThreadType!

  """Retrieve all email threads for the specific team"""
  emailThreads(teamId: ID!): [EmailThreadType!]!

  """Retrieve all channels for an exercise"""
  exerciseChannels(exerciseId: ID!): [DefinitionChannelType!]!

  """Retrieve the config for the current running exercise"""
  exerciseConfig(exerciseId: ID!): GrapheneConfig!

  """Retrieve an exercise with matching id"""
  exerciseId(exerciseId: ID!): ExerciseType!

  """Retrieve the state of the exercise loop for the specific exercise"""
  exerciseLoopRunning(exerciseId: ID!): Boolean!

  """Retrieve all questionnaire states for this exercise"""
  exerciseQuestionnaires(exerciseId: ID!): [TeamQuestionnaireStateType!]!

  """Retrieve the amount of time left in the running exercise in seconds"""
  exerciseTimeLeft: Int!

  """Retrieve all tools for the specific exercise. Useful for analytics."""
  exerciseTools(exerciseId: ID!): [ToolType!]!

  """Retrieve all exercises with optional parameters"""
  exercises(
    """Retrieves only finished exercises, Not required"""
    finished: Boolean

    """Skips first n results, Not required"""
    limit: Int

    """Retrieves only running exercises, Not required"""
    running: Boolean

    """Retrieves only the first n results, Not required"""
    skip: Int
  ): [ExerciseType!]!

  """
  Retrieve all tools available to the specific team including all possible responses
  """
  extendedTeamTools(teamId: ID!): [ExtendedToolType!]!

  """Retrieve a specific file info"""
  fileInfo(fileInfoId: UUID!): FileInfoType!
  getEmailDraft(emailThreadId: ID, instructor: Boolean!, teamId: ID!): EmailDraftType
  getEmailDrafts(instructor: Boolean!, teamId: ID!): [EmailDraftType]

  """Retrieve all automatic injects"""
  injects(exerciseId: ID!): [DefinitionInjectType!]!

  """Retrieve all learning objectives for an exercise"""
  learningObjectives(exerciseId: ID!): [LearningObjectiveType!]!

  """Retrieve all milestones"""
  milestones(exerciseId: ID!): [MilestoneType!]!
  noopReceipt: MutationResult
  noopReload: MutationResult
  noopTodo: MutationResult

  """Retrieve the specific questionnaire state for this team"""
  questionnaireState(questionnaireId: ID!, teamId: ID!): TeamQuestionnaireStateType!

  """Retrieve all questionnaires for an exercise"""
  questionnaires(exerciseId: ID!): [QuestionnaireType!]!

  """Retrieve all tags (for filtering)"""
  tags: [TagType!]!

  """Retrieve a specific team"""
  team(teamId: ID!): TeamType!

  """
  Retrieve all action logs for the specific team ordered ascending by timestamp
  """
  teamActionLogs(exerciseId: ID, teamId: ID!): [ActionLogType!]!

  """
  Retrieve all team action logs for the specific channel ordered ascending by timestamp
  """
  teamChannelLogs(channelId: ID!, exerciseId: ID, teamId: ID!): [ActionLogType!]!

  """Retrieve the email participant that belongs to the specified team"""
  teamEmailParticipant(teamId: ID!): EmailParticipantType!

  """Retrieve the learning objectives for the specific team"""
  teamLearningObjectives(teamId: ID!): [TeamLearningObjectiveType!]!

  """Retrieve a specific milestone state"""
  teamMilestone(milestoneStateId: ID!): MilestoneStateType!

  """
  Retrieve all milestones for the specific team filtered by team visibility
  """
  teamMilestones(
    exerciseId: ID
    teamId: ID!

    """
    Not required, defaults to true returns only milestones that are visible to the team.
                If set to false then all milestones (even not visible to team) are sent
    """
    visibleOnly: Boolean
  ): [MilestoneStateType!]!

  """Retrieve all questionnaire states for this team"""
  teamQuestionnaires(teamId: ID!): [TeamQuestionnaireStateType!]!

  """Retrieve all team roles for the running exercise"""
  teamRoles: [String!]!

  """Retrieve all tools available to the specific team"""
  teamTools(teamId: ID!): [ToolType!]!

  """Retrieve all files uploaded by/to the specified team"""
  teamUploadedFiles(teamId: ID!): [FileInfoType!]!

  """Retrieve the specific email template"""
  threadTemplate(templateId: ID!): EmailTemplateType!

  """Retrieve all email templates for the specific thread"""
  threadTemplates(threadId: ID!): [EmailTemplateType!]!
  user(userId: UUID!): UserType!

  """Retrieve all users with filtering options"""
  users(filterUsersInput: FilterUsersInput): [UserType!]!

  """Validates if the email address is valid for the specified exercise"""
  validateEmailAddress(address: String!, exerciseId: ID!): Boolean!

  """Retrieve data of the currently logged-in user of the request"""
  whoAmI: UserType
}

union QuestionDetails = FreeFormQuestionDetailsType | RadioQuestionDetailsType

type QuestionRelatedMilestonesType {
  milestones: [MilestoneStateType!]!
  questionId: ID!
}

type QuestionType {
  content: ContentType!
  details: QuestionDetails!
  id: ID!
  questionnaire: QuestionnaireType!
  type: QuestionTypes!
}

"""An enumeration."""
enum QuestionTypes {
  FREE_FORM
  RADIO
}

type QuestionnaireAnswerType {
  answer: String!
  id: ID!
  isCorrect: Boolean
  question: QuestionType!
  teamQuestionnaireState: TeamQuestionnaireStateType!
}

input QuestionnaireInput {
  answers: [AnswerInput!]!
  questionnaireId: ID!
  teamId: ID!
}

type QuestionnaireInputType {
  answers: [AnswerType!]!
  questionnaireId: ID!
  teamId: ID!
}

input QuestionnaireReviewInput {
  activateMilestones: [String!]!
  deactivateMilestones: [String!]!
  questionnaireId: ID!
  teamId: ID!
}

type QuestionnaireReviewInputType {
  activateMilestones: [String!]!
  deactivateMilestones: [String!]!
  questionnaireId: ID!
  teamId: ID!
}

type QuestionnaireType {
  content: ContentType!
  control: ControlType!
  definition: DefinitionType!
  id: ID!
  overlay: OverlayType
  questions: [QuestionType!]!
  teamQuestionnaireStates: [TeamQuestionnaireStateType!]!
  time: Int!
  title: String!
}

type RadioQuestionDetailsType {
  controls: [ControlsMapType!]!
  correct: Int!
  definition: ExerciseDefinitionType!
  id: ID!
  labels: String!
  max: Int!
}

type ReadReceiptType {
  actionLogId: ID!
  readReceipt: DateTime
}

type RegenerateCredentialsMutation {
  operationDone: Boolean!
}

type RemoveDefinitionAccessMutation {
  operationDone: Boolean!
}

type RemoveInstructorsFromExerciseMutation {
  operationDone: Boolean!
}

type RemoveUsersFromTeamMutation {
  operationDone: Boolean!
}

type RestrictedExercise {
  id: ID!
  name: String!
  uuid: UUID!
}

type RestrictedTeam {
  emailAddress: EmailParticipantType
  exercise: ExerciseType!
  id: ID!
  name: String!
  role: String!
}

type RestrictedUser {
  dateJoined: DateTime!
  firstName: String
  group: AuthGroup
  id: UUID!
  isActive: Boolean!
  isImported: Boolean!
  lastLogin: DateTime
  lastName: String
  tags: [TagType!]!
  username: String!
}

type ReviewQuestionnaireMutation {
  updatedState: TeamQuestionnaireStateType!
}

type SendCustomInjectMutation {
  operationDone: Boolean!
}

input SendEmailInput {
  activateMilestone: String = ""
  content: String = ""
  deactivateMilestone: String = ""
  fileId: UUID
  senderAddress: String!
  threadId: ID!
}

type SendEmailMutation {
  email: EmailType!
  operationDone: Boolean!
}

type SendEmailType {
  activateMilestone: String
  content: String
  deactivateMilestone: String
  fileId: UUID
  senderAddress: String!
  threadId: ID!
}

type StartExerciseMutation {
  exercise: ExerciseType!
}

"""An enumeration."""
enum Status {
  ANSWERED
  REVIEWED
  SENT
  UNSENT
}

type StopExerciseMutation {
  exercise: ExerciseType!
}

type Subscription {
  """Subscription notifies about new action logs for the specific team"""
  actionLogs(teamId: ID!): ActionLogsSubscription

  """Subscription notifies about new action logs for the specific exercise"""
  analyticsActionLogsSubscription(exerciseId: ID!): AnalyticsActionLogsSubscription

  """
  Subscription notifies about new email threads and new emails for the specific exercise
  """
  analyticsEmailThreadSubscription(exerciseId: ID!): AnalyticsEmailThreadSubscription

  """Subscription notifies about changes in milestone states"""
  analyticsMilestonesSubscription(exerciseId: ID!): AnalyticsMilestonesSubscription

  """
  Subscription notifies about new threads and new emails for the specific team
  """
  emailThreads(teamId: ID!): EmailThreadSubscription

  """Subscription notifies about the state of the exercise loop"""
  exerciseLoopRunning(exerciseId: ID!): ExerciseLoopRunningSubscription

  """Subscription that notifies when exercises were modified"""
  exercisesSubscription: ExercisesSubscription

  """Subscription notifies about changes in milestone states"""
  milestones(
    teamId: ID!

    """
    Not required, defaults to true returns only milestones that are visible to the team.
                If set to false then all milestones (even not visible to team) are sent
    """
    visibleOnly: Boolean
  ): MilestonesSubscription

  """
  Subscription notifies about changes to the state of a teams questionnaires
  """
  teamQuestionnaireStateSubscription(teamId: ID!): TeamQuestionnaireStateSubscription
}

type TagType {
  id: ID!
  name: String!
}

type TeamLearningActivityType {
  activity: LearningActivityType!
  id: ID!
  milestoneStates: [MilestoneStateType!]!
  reached: Boolean
  teamObjective: TeamLearningObjectiveType!
}

type TeamLearningObjectiveType {
  activities: [TeamLearningActivityType!]!
  id: ID!
  objective: LearningObjectiveType!
  reached: Boolean
}

type TeamQuestionnaireStateSubscription {
  teamQuestionnaireState: TeamQuestionnaireStateType!
}

type TeamQuestionnaireStateType {
  answers: [QuestionnaireAnswerType!]!
  id: ID!
  questionnaire: QuestionnaireType!
  relatedMilestones: [QuestionRelatedMilestonesType!]!
  reviewedBy: RestrictedUser
  status: Status!
  team: TeamType!
  timestampAnswered: DateTime
  timestampReviewed: DateTime
  timestampSent: DateTime
  todo: Boolean!
}

type TeamType {
  emailAddress: EmailParticipantType
  exercise: ExerciseType!
  finishTime: DateTime
  id: ID!
  logs: [ActionLogType!]!
  name: String!
  role: String!
  teamQuestionnaireStates: [TeamQuestionnaireStateType!]!
  users: [RestrictedUser!]!
}

type ToolDetailsType {
  argument: String!
  content: ContentType!
  id: ID!
  tool: ToolType!
  user: RestrictedUser
}

type ToolResponseType {
  content: ContentType!
  control: ControlType!
  id: ID!
  param: String!
  regex: Boolean!
  time: Int!
  tool: ExtendedToolType!
}

type ToolType {
  category: String!
  defaultResponse: String!
  definition: ExerciseDefinitionType!
  hint: String!
  id: ID!
  name: String!
  roles: String!
  tooltipDescription: String!
}

"""
Leverages the internal Python implmeentation of UUID (uuid.UUID) to provide native UUID objects
in fields, resolvers and input.
"""
scalar UUID

input UpdateTagAssignmentsInput {
  addTags: [ID!]! = []
  removeTags: [ID!]! = []
  userIds: [ID!]!
}

type UpdateTagAssignmentsMutation {
  operationDone: Boolean!
}

type UpdateTagAssignmentsType {
  addTags: [ID!]!
  removeTags: [ID!]!
  userIds: [ID!]!
}

type UpdateTagMutation {
  updatedTag: TagType!
}

input UseToolInput {
  teamId: ID!

  """Parameter provided by the trainee."""
  toolArgument: String!
  toolId: ID!
}

type UseToolMutation {
  actionLog: ActionLogType!
  operationDone: Boolean!
}

type UseToolType {
  teamId: ID!

  """Parameter provided by the trainee."""
  toolArgument: String!
  toolId: ID!
}

type UserType {
  createdExercises: [RestrictedExercise!]!
  dateJoined: DateTime!
  definitions: [ExerciseDefinitionType!]!
  exercises: [RestrictedExercise!]!
  firstName: String
  group: AuthGroup!
  id: UUID!
  isActive: Boolean!
  isImported: Boolean!
  lastLogin: DateTime
  lastName: String
  tags: [TagType!]!
  teams: [RestrictedTeam!]!
  uploadedDefinitions: [ExerciseDefinitionType!]!
  username: String!
}