# ------------------------------------------------------
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------

type Person {
  _id: UUID!
  givenName: String!
  familyName: String!
  email: EmailAddress!
  master: Boolean
  token: String
  _adminOf: [UUID!]
  adminOf: [Organizer!]
  _organizerOf: [UUID!]
  organizerOf: [Organizer!]
}

"""UUID"""
scalar UUID

"""
A field whose value conforms to the standard internet email address format as specified in RFC822: https://www.w3.org/Protocols/rfc822/.
"""
scalar EmailAddress

type Organizer {
  _id: UUID!
  name: String!
  plz: Int
  ort: String
  logo: String
  _admins: [UUID!]
  _organizers: [UUID!]
  _pending: [UUID!]
  admins: [Person!]
  organizers: [Person!]
  pending: [Person!]
}

type Apparatus {
  _id: UUID!
  name: String!
  logo: String
}

type Team {
  _id: UUID!
  name: String!
}

type Result {
  bonus: Int!
  runtime: Float!
  calctime: Float!
  results: [ApparatusResult!]!
}

type ApparatusResult {
  _id: UUID!
  bonus: Boolean!
  teile: Boolean!
  wechsel: Boolean
}

type Timeslot {
  _id: UUID!
  time: Time!
  duration: Int!
  team: Team
  result: Result
}

"""A time string HH:MM:SS"""
scalar Time

type EventApparatus {
  _apparatus: UUID!
  elements: Int!
  bonus: Int!
  malus: Int!
  apparatus: Apparatus!
}

type Event {
  _id: UUID!
  name: String
  date: Date!
  apparatus: [EventApparatus!]!
  timeslots: [Timeslot!]!
  _organizer: UUID!
  organizer: Organizer!
}

"""A date string YYYY-MM-DD"""
scalar Date

type Query {
  Person(id: UUID!): Person
  PersonFind(offset: Int, limit: Int, email: String, familyName: String, givenName: String): [Person!]
  Apparatus(id: UUID!): Apparatus
  ApparatusFind(offset: Int, limit: Int, name: String): [Apparatus!]
  Organizer(id: UUID!): Organizer
  OrganizerFind(offset: Int, limit: Int, ort: String, plz: Int, name: String): [Organizer!]
  Event(id: UUID!): Event
  EventFind(offset: Int, limit: Int, organizer: UUID, date: Date): [Event!]
}

type Mutation {
  login(token: String, passwort: String, email: String): Person!
  PersonRegister(passwort: String!, email: EmailAddress!, familyName: String!, givenName: String!, organizer: UUID!): Person!
  PersonConfirmMail(confirmCode: String!, email: String!): Person
  PersonPasswordReset(newPassword: String, resetCode: String, email: EmailAddress!): Boolean
  ChangePassword(newPassword: String!, oldPassword: String!): Boolean!
  PersonUpdate(master: Boolean, email: EmailAddress, familyName: String, givenName: String, id: UUID!): Person!
  PersonCreate(master: Boolean, email: EmailAddress!, familyName: String!, givenName: String!): Person!
  PersonDelete(id: UUID!): UUID!
  ApparatusUpdate(logo: String, name: String, id: UUID!): Apparatus!
  ApparatusCreate(logo: String, name: String!): Apparatus!
  ApparatusDelete(id: UUID!): UUID!
  OrganizerRegister(ort: String, plz: Int, name: String!): Organizer!
  OrganizerUpdate(ort: String, plz: Int, name: String, id: UUID!): Organizer!
  OrganizerCreate(ort: String, plz: Int, name: String!): Organizer!
  OrganizerDelete(id: UUID!): UUID!
  OrganizerUpdateMakeOrganizer(person: UUID!, id: UUID!): Organizer!
  OrganizerUpdateMakeAdmin(person: UUID!, id: UUID!): Organizer!
  OrganizerUpdateDeletePerson(person: UUID!, id: UUID!): Organizer!
  EventCreate(name: String, date: Date!, organizer: UUID!): Event!
  EventUpdate(date: Date, name: String, id: UUID!): Event!
  EventAddApparatus(apparatus: UUID!, id: UUID!): Event!
  EventDeleteApparatus(apparatus: UUID!, id: UUID!): Event!
  EventUpdateApparatus(malus: Float, bonus: Float, elements: Int, apparatus: UUID!, id: UUID!): Event!
  EventOrderApparatus(target: Int!, src: Int!, id: UUID!): Event!
  EventAddTimeslots(timeslots: [ITimeslot!]!, id: UUID!): Event!
  EventDeleteTimeslots(timeslots: [UUID!]!, id: UUID!): Event!
  EventAddTeam(name: String!, timeslot: UUID!, id: UUID!): Event!
  EventDeleteTeam(timeslot: UUID!, id: UUID!): Event!
  EventSetResult(result: IResult!, timeslot: UUID!, id: UUID!): Timeslot!
  EventDelete(id: UUID!): UUID!
}

input ITimeslot {
  time: Time!
  duration: Int!
}

input IResult {
  bonus: Int!
  runtime: Float!
  calctime: Float!
  results: [IApparatusResult!]!
}

input IApparatusResult {
  _id: UUID!
  bonus: Boolean!
  teile: Boolean!
  wechsel: Boolean
}

type Subscription {
  PersonUpdated: Person
  PersonDeleted: UUID!
  ApparatusUpdated: Apparatus
  ApparatusDeleted: UUID!
  OrganizerUpdated(organizer: UUID): Organizer!
  OrganizerDeleted: UUID!
  EventUpdated(organizer: UUID, id: UUID): Event!
  EventDeleted(organizer: UUID!): UUID!
}
