type Query {
  course_statistics(course_id: ID!): CourseStatisticsType
  course_progress(course_id: ID!): CourseProgressType
  dashboard_config: [DashboardConfigType!]!
  learning_path(id: ID, slug: String, course_id: ID, course_slug: String): LearningPathObjectType
  course_session_attendance_course(id: ID!, assignment_user_id: ID): CourseSessionAttendanceCourseObjectType
  course(id: ID, slug: String): CourseObjectType
  course_session(id: ID): CourseSessionObjectType
  learning_content_media_library: LearningContentMediaLibraryObjectType
  learning_content_assignment: LearningContentAssignmentObjectType
  learning_content_attendance_course: LearningContentAttendanceCourseObjectType
  learning_content_feedback_uk: LearningContentFeedbackUKObjectType
  learning_content_feedback_vv: LearningContentFeedbackVVObjectType
  learning_content_learning_module: LearningContentLearningModuleObjectType
  learning_content_knowledge_assessment: LearningContentKnowledgeAssessmentObjectType
  learning_content_placeholder: LearningContentPlaceholderObjectType
  learning_content_rich_text: LearningContentRichTextObjectType
  learning_content_test: LearningContentEdoniqTestObjectType
  learning_content_video: LearningContentVideoObjectType
  learning_content_document_list: LearningContentDocumentListObjectType
  competence_certificate(id: ID, slug: String): CompetenceCertificateObjectType
  competence_certificate_list(id: ID, slug: String, course_id: ID, course_slug: String): CompetenceCertificateListObjectType
  assignment(id: ID, slug: String): AssignmentObjectType
  assignment_completion(assignment_id: ID!, course_session_id: ID!, learning_content_page_id: ID, assignment_user_id: UUID): AssignmentCompletionObjectType
}

type CourseStatisticsType {
  _id: ID!
  course_id: ID!
  course_title: String!
  course_slug: String!
  course_session_properties: StatisticsCourseSessionPropertiesType!
  course_session_selection_ids: [ID]!
  course_session_selection_metrics: StatisticsCourseSessionsSelectionMetricType!
  attendance_day_presences: AttendanceDayPresencesStatisticsType!
  feedback_responses: FeedbackStatisticsResponsesType!
  assignments: AssignmentsStatisticsType!
  competences: CompetencesStatisticsType!
}

type StatisticsCourseSessionPropertiesType {
  _id: ID!
  sessions: [StatisticsCourseSessionDataType!]!
  generations: [String!]!
  circles: [StatisticsCircleDataType!]!
}

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

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

type StatisticsCourseSessionsSelectionMetricType {
  _id: ID!
  session_count: Int!
  participant_count: Int!
  expert_count: Int!
}

type AttendanceDayPresencesStatisticsType {
  _id: ID!
  records: [PresenceRecordStatisticsType!]!
  summary: AttendanceSummaryStatisticsType!
}

type PresenceRecordStatisticsType {
  _id: ID!
  course_session_id: ID!
  generation: String!
  circle_id: ID!
  due_date: DateTime!
  participants_present: Int!
  participants_total: Int!
  details_url: String!
}

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

type AttendanceSummaryStatisticsType {
  _id: ID!
  days_completed: Int!
  participants_present: Int!
}

type FeedbackStatisticsResponsesType {
  _id: ID!
  records: [FeedbackStatisticsRecordType!]!
  summary: FeedbackStatisticsSummaryType!
}

type FeedbackStatisticsRecordType {
  _id: ID!
  course_session_id: ID!
  generation: String!
  circle_id: ID!
  satisfaction_average: Float!
  satisfaction_max: Int!
  details_url: String!
  experts: String!
}

type FeedbackStatisticsSummaryType {
  _id: ID!
  satisfaction_average: Float!
  satisfaction_max: Int!
  total_responses: Int!
}

type AssignmentsStatisticsType {
  _id: ID!
  records: [AssignmentStatisticsRecordType!]!
  summary: AssignmentStatisticsSummaryType!
}

type AssignmentStatisticsRecordType {
  _id: ID!
  course_session_id: ID!
  course_session_assignment_id: ID!
  circle_id: ID!
  generation: String!
  assignment_type_translation_key: String!
  assignment_title: String!
  deadline: DateTime!
  metrics: AssignmentCompletionMetricsType!
  details_url: String!
}

type AssignmentCompletionMetricsType {
  _id: ID!
  passed_count: Int!
  failed_count: Int!
  unranked_count: Int!
  ranking_completed: Boolean!
  average_passed: Float!
}

type AssignmentStatisticsSummaryType {
  _id: ID!
  completed_count: Int!
  average_passed: Float!
}

type CompetencesStatisticsType {
  _id: ID!
  summary: CompetencePerformanceStatisticsSummaryType!
  records: [CompetenceRecordStatisticsType!]!
}

type CompetencePerformanceStatisticsSummaryType {
  _id: ID!
  success_total: Int!
  fail_total: Int!
}

type CompetenceRecordStatisticsType {
  _id: ID!
  course_session_id: ID!
  generation: String!
  title: String!
  circle_id: ID!
  success_count: Int!
  fail_count: Int!
  details_url: String!
}

type CourseProgressType {
  _id: ID!
  course_id: ID!
  session_to_continue_id: ID
  competence: ProgressDashboardCompetenceType!
  assignment: ProgressDashboardAssignmentType!
}

type ProgressDashboardCompetenceType {
  _id: ID!
  total_count: Int!
  success_count: Int!
  fail_count: Int!
}

type ProgressDashboardAssignmentType {
  _id: ID!
  total_count: Int!
  points_max_count: Int!
  points_achieved_count: Int!
}

type DashboardConfigType {
  id: ID!
  name: String!
  slug: String!
  dashboard_type: DashboardType!
}

enum DashboardType {
  STATISTICS_DASHBOARD
  PROGRESS_DASHBOARD
  SIMPLE_DASHBOARD
}

type LearningPathObjectType implements CoursePageInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  topics: [TopicObjectType!]!
}

interface CoursePageInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
}

type CourseObjectType {
  id: ID!
  title: String!
  category_name: String!
  slug: String!
  enable_circle_documents: Boolean!
  learning_path: LearningPathObjectType!
  action_competences: [ActionCompetenceObjectType!]!
}

type ActionCompetenceObjectType implements CoursePageInterface {
  competence_id: String!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  performance_criteria: [PerformanceCriteriaObjectType!]!
}

type PerformanceCriteriaObjectType implements CoursePageInterface {
  competence_id: String!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  learning_unit: LearningUnitObjectType
}

type LearningUnitObjectType implements CoursePageInterface {
  title_hidden: Boolean!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  learning_contents: [LearningContentInterface!]!
  performance_criteria: [PerformanceCriteriaObjectType!]!
  evaluate_url: String!
}

interface LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type CircleLightObjectType {
  id: ID!
  title: String!
  slug: String!
}

type TopicObjectType implements CoursePageInterface {
  is_visible: Boolean!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  circles: [CircleObjectType!]!
}

type CircleObjectType implements CoursePageInterface {
  description: String!
  goals: String!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  learning_sequences: [LearningSequenceObjectType!]!
}

type LearningSequenceObjectType implements CoursePageInterface {
  icon: String!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  learning_units: [LearningUnitObjectType!]!
}

type CourseSessionAttendanceCourseObjectType {
  id: ID!
  learning_content: LearningContentAttendanceCourseObjectType!
  due_date: DueDateObjectType
  location: String!
  trainer: String!
  course_session_id: ID
  learning_content_id: ID
  attendance_user_list: [AttendanceUserObjectType]
}

type LearningContentAttendanceCourseObjectType implements CoursePageInterface & LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type DueDateObjectType {
  id: ID!

  """Startdatum ist Pflicht"""
  start: DateTime

  """Enddatum ist optional"""
  end: DateTime

  """Nur aktivieren, wenn man die Felder manuell überschreiben will"""
  manual_override_fields: Boolean!

  """Title wird standarmässig vom LearningContent übernommen"""
  title: String!

  """Translation Key aus dem Frontend"""
  assignment_type_translation_key: String!

  """Translation Key aus dem Frontend"""
  date_type_translation_key: String!

  """
  Überschreibt den Untertitel bei `assignment_type_translation_key` und `date_type_translation_key`
  """
  subtitle: String!

  """
  URL wird vom LearningContent übernommen (sichtbar für Member/Teilnehmer)
  """
  url: String!
  course_session: CourseSessionObjectType!
}

type CourseSessionObjectType {
  id: ID!
  created_at: DateTime!
  updated_at: DateTime!
  course: CourseObjectType!
  title: String!
  start_date: Date
  end_date: Date
  attendance_courses: [CourseSessionAttendanceCourseObjectType!]!
  assignments: [CourseSessionAssignmentObjectType!]!
  edoniq_tests: [CourseSessionEdoniqTestObjectType!]!
  users: [CourseSessionUserObjectsType!]!
}

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

type CourseSessionAssignmentObjectType {
  id: ID!
  learning_content: LearningContentAssignmentObjectType!
  submission_deadline: DueDateObjectType
  evaluation_deadline: DueDateObjectType
  course_session_id: ID!
  learning_content_id: ID!
}

type LearningContentAssignmentObjectType implements CoursePageInterface & LearningContentInterface {
  content_assignment: AssignmentObjectType!
  assignment_type: LearnpathLearningContentAssignmentAssignmentTypeChoices!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
  competence_certificate: CompetenceCertificateObjectType
}

type AssignmentObjectType implements CoursePageInterface {
  assignment_type: AssignmentAssignmentAssignmentTypeChoices!

  """
  Muss der Auftrag durch eine/n Experten/in oder eine Lernbegleitung beurteilt werden?
  """
  needs_expert_evaluation: Boolean!
  competence_certificate: CompetenceCertificateObjectType

  """Erläuterung der Ausgangslage"""
  intro_text: String!

  """Zeitaufwand als Text"""
  effort_required: String!

  """Beschreibung der Bewertung"""
  evaluation_description: String!

  """URL zum Beurteilungsinstrument"""
  evaluation_document_url: String!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  tasks: JSONStreamField
  evaluation_tasks: JSONStreamField
  performance_objectives: JSONStreamField
  max_points: Int
  learning_content: LearningContentInterface
  completion(course_session_id: ID!, learning_content_page_id: ID, assignment_user_id: UUID): AssignmentCompletionObjectType
  solution_sample: ContentDocumentObjectType
}

"""An enumeration."""
enum AssignmentAssignmentAssignmentTypeChoices {
  """PRAXIS_ASSIGNMENT"""
  PRAXIS_ASSIGNMENT

  """CASEWORK"""
  CASEWORK

  """PREP_ASSIGNMENT"""
  PREP_ASSIGNMENT

  """REFLECTION"""
  REFLECTION

  """CONDITION_ACCEPTANCE"""
  CONDITION_ACCEPTANCE

  """EDONIQ_TEST"""
  EDONIQ_TEST
}

type CompetenceCertificateObjectType implements CoursePageInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  assignments: [AssignmentObjectType!]!
}

scalar JSONStreamField

type AssignmentCompletionObjectType {
  id: UUID!
  created_at: DateTime!
  updated_at: DateTime!
  submitted_at: DateTime
  evaluation_submitted_at: DateTime
  evaluation_user: UserObjectType
  evaluation_points: Float
  evaluation_max_points: Float
  evaluation_passed: Boolean
  edoniq_extended_time_flag: Boolean!
  assignment_user: UserObjectType!
  assignment: AssignmentObjectType!
  course_session: CourseSessionObjectType!
  completion_status: AssignmentAssignmentCompletionCompletionStatusChoices!
  completion_data: GenericScalar
  additional_json_data: JSONString!
  task_completion_data: GenericScalar
  learning_content_page_id: ID
}

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

type UserObjectType {
  """
  Erforderlich. 150 Zeichen oder weniger. Nur Buchstaben, Ziffern und @/./+/-/_.
  """
  username: String!
  first_name: String!
  last_name: String!
  id: UUID!
  avatar_url: String!
  email: String!
  language: CoreUserLanguageChoices!
}

"""An enumeration."""
enum CoreUserLanguageChoices {
  """Deutsch"""
  DE

  """Français"""
  FR

  """Italiano"""
  IT
}

"""An enumeration."""
enum AssignmentAssignmentCompletionCompletionStatusChoices {
  """IN_PROGRESS"""
  IN_PROGRESS

  """SUBMITTED"""
  SUBMITTED

  """EVALUATION_IN_PROGRESS"""
  EVALUATION_IN_PROGRESS

  """EVALUATION_SUBMITTED"""
  EVALUATION_SUBMITTED
}

"""
The `GenericScalar` scalar type represents a generic
GraphQL scalar value that could be:
String, Boolean, Int, Float, List or Object.
"""
scalar GenericScalar

"""
Allows use of a JSON String for input / output from the GraphQL schema.

Use of this type is *not recommended* as you lose the benefits of having a defined, static
schema (one of the key benefits of GraphQL).
"""
scalar JSONString

type ContentDocumentObjectType {
  id: ID!
  display_text: String!
  description: String!
  link_display_text: String!
  thumbnail: String!
  url: String
}

"""An enumeration."""
enum LearnpathLearningContentAssignmentAssignmentTypeChoices {
  """PRAXIS_ASSIGNMENT"""
  PRAXIS_ASSIGNMENT

  """CASEWORK"""
  CASEWORK

  """PREP_ASSIGNMENT"""
  PREP_ASSIGNMENT

  """REFLECTION"""
  REFLECTION

  """CONDITION_ACCEPTANCE"""
  CONDITION_ACCEPTANCE

  """EDONIQ_TEST"""
  EDONIQ_TEST
}

type CourseSessionEdoniqTestObjectType {
  id: ID!
  learning_content: LearningContentEdoniqTestObjectType!
  deadline: DueDateObjectType
  course_session_id: ID!
  learning_content_id: ID!
}

type LearningContentEdoniqTestObjectType implements CoursePageInterface & LearningContentInterface {
  checkbox_text: String!
  content_assignment: AssignmentObjectType!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
  competence_certificate: CompetenceCertificateObjectType
  has_extended_time_test: Boolean!
}

"""
WORKAROUND:
Why is this no DjangoObjectType? It's because we have to "inject"
the supervisor into the list of users. This is done in the resolve_users
of the CourseSessionObjectType. And there we have to be able to construct
a CourseSessionUserObjectsType with the CIRCLES of the supervisor!
"""
type CourseSessionUserObjectsType {
  id: ID!
  user_id: UUID!
  first_name: String!
  last_name: String!
  email: String!
  avatar_url: String!
  role: String!
  circles: [CourseSessionUserExpertCircleType!]!
}

type CourseSessionUserExpertCircleType {
  id: ID!
  title: String!
  slug: String!
}

type AttendanceUserObjectType {
  user_id: UUID!
  status: AttendanceUserStatus!
  first_name: String
  last_name: String
  email: String
}

"""An enumeration."""
enum AttendanceUserStatus {
  PRESENT
  ABSENT
}

type LearningContentMediaLibraryObjectType implements CoursePageInterface & LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type LearningContentFeedbackUKObjectType implements CoursePageInterface & LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type LearningContentFeedbackVVObjectType implements CoursePageInterface & LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type LearningContentLearningModuleObjectType implements CoursePageInterface & LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type LearningContentKnowledgeAssessmentObjectType implements CoursePageInterface & LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type LearningContentPlaceholderObjectType implements CoursePageInterface & LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type LearningContentRichTextObjectType implements CoursePageInterface & LearningContentInterface {
  text: String!
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type LearningContentVideoObjectType implements CoursePageInterface & LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type LearningContentDocumentListObjectType implements CoursePageInterface & LearningContentInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  minutes: Int
  description: String!
  content_url: String!
  can_user_self_toggle_course_completion: Boolean!
  circle: CircleLightObjectType
}

type CompetenceCertificateListObjectType implements CoursePageInterface {
  id: ID!
  title: String!
  slug: String!
  content_type: String!
  live: Boolean!
  translation_key: String!
  frontend_url: String!
  course: CourseObjectType
  competence_certificates: [CompetenceCertificateObjectType!]!
}

type Mutation {
  send_feedback(course_session_id: ID!, data: GenericScalar, learning_content_page_id: ID!, learning_content_type: String!, submitted: Boolean = false): SendFeedbackMutation
  update_course_session_attendance_course_users(attendance_user_list: [AttendanceUserInputType]!, id: ID!): AttendanceCourseUserMutation
  upsert_assignment_completion(assignment_id: ID!, assignment_user_id: UUID, completion_data_string: String, completion_status: AssignmentCompletionStatus, course_session_id: ID!, evaluation_passed: Boolean, evaluation_points: Float, initialize_completion: Boolean, learning_content_page_id: ID): AssignmentCompletionMutation
}

type SendFeedbackMutation {
  feedback_response: FeedbackResponseObjectType

  """May contain more than one error for same field."""
  errors: [ErrorType]
}

type FeedbackResponseObjectType {
  id: UUID!
  data: GenericScalar
  submitted: Boolean!
}

type ErrorType {
  field: String!
  messages: [String!]!
}

type AttendanceCourseUserMutation {
  course_session_attendance_course: CourseSessionAttendanceCourseObjectType
}

input AttendanceUserInputType {
  user_id: UUID!
  status: AttendanceUserStatus!
}

type AssignmentCompletionMutation {
  assignment_completion: AssignmentCompletionObjectType
}

"""An enumeration."""
enum AssignmentCompletionStatus {
  IN_PROGRESS
  SUBMITTED
  EVALUATION_IN_PROGRESS
  EVALUATION_SUBMITTED
}
