input AnalysisInput {
  type: String!
  status: AnalysisStatus!
  output: String = null
  outputs: JSON = null
  sequencingGroupIds: [String!] = null
  cohortIds: [String!] = null
  author: String = null
  timestampCompleted: String = null
  active: Boolean = null
  meta: JSON!
}

type AnalysisMutations {
  createAnalysis(project: String!, analysis: AnalysisInput!): GraphQLAnalysis!
  updateAnalysis(analysisId: Int!, analysis: AnalysisUpdateInput!): GraphQLAnalysis!
}

input AnalysisRunnerInput {
  arGuid: String!
  accessLevel: String!
  repository: String!
  commit: String!
  script: String!
  description: String!
  driverImage: String!
  configPath: String!
  environment: String!
  batchUrl: String!
  submittingUser: String!
  meta: JSON!
  outputPath: String!
  hailVersion: String = null
  cwd: String = null
}

type AnalysisRunnerMutations {
  createAnalysisRunnerLog(project: String!, analysisRunner: AnalysisRunnerInput!): String!
}

enum AnalysisStatus {
  QUEUED
  IN_PROGRESS
  FAILED
  COMPLETED
  UNKNOWN
}

"""Filter for GraphQL queries"""
input AnalysisStatusGraphQLFilter {
  eq: AnalysisStatus = null
  in_: [AnalysisStatus!] = null
  nin: [AnalysisStatus!] = null
  gt: AnalysisStatus = null
  gte: AnalysisStatus = null
  lt: AnalysisStatus = null
  lte: AnalysisStatus = null
  contains: AnalysisStatus = null
  icontains: AnalysisStatus = null
  startswith: AnalysisStatus = null
  isnull: Boolean = null
}

input AnalysisUpdateInput {
  status: AnalysisStatus = null
  output: String = null
  outputs: JSON = null
  meta: JSON = null
  active: Boolean = null
}

type AssayMutations {
  addComment(content: String!, id: Int!): GraphQLComment!
  createAssay(assay: AssayUpsertInput!): GraphQLAssay!
  updateAssay(assay: AssayUpsertInput!): GraphQLAssay!
}

input AssayUpsertInput {
  id: Int = null
  type: String = null
  externalIds: JSON = null
  sampleId: String = null
  meta: JSON = null
}

"""Filter for GraphQL queries"""
input BoolGraphQLFilter {
  eq: Boolean = null
  in_: [Boolean!] = null
  nin: [Boolean!] = null
  gt: Boolean = null
  gte: Boolean = null
  lt: Boolean = null
  lte: Boolean = null
  contains: Boolean = null
  icontains: Boolean = null
  startswith: Boolean = null
  isnull: Boolean = null
}

input CohortBodyInput {
  name: String!
  description: String!
  templateId: String = null
}

input CohortCriteriaInput {
  projects: [String!] = null
  sgIdsInternal: [String!] = null
  excludedSgsInternal: [String!] = null
  sgTechnology: [String!] = null
  sgPlatform: [String!] = null
  sgType: [String!] = null
  sampleType: [String!] = null
}

type CohortMutations {
  createCohortFromCriteria(project: String!, cohortSpec: CohortBodyInput!, cohortCriteria: CohortCriteriaInput = null, dryRun: Boolean! = false, excludeIneligibleSgIdsInternal: Boolean! = false): CreatedGraphQLCohort!
  createCohortTemplate(project: String!, template: CohortTemplateInput!): GraphQLCohortTemplate!
  updateCohort(id: String!, cohort: CohortUpdateBodyInput!): GraphQLCohort!
}

enum CohortStatus {
  active
  archived
  invalid
}

"""Filter for GraphQL queries"""
input CohortStatusGraphQLFilter {
  eq: CohortStatus = null
  in_: [CohortStatus!] = null
  nin: [CohortStatus!] = null
  gt: CohortStatus = null
  gte: CohortStatus = null
  lt: CohortStatus = null
  lte: CohortStatus = null
  contains: CohortStatus = null
  icontains: CohortStatus = null
  startswith: CohortStatus = null
  isnull: Boolean = null
}

input CohortTemplateInput {
  id: Int = null
  name: String!
  description: String!
  criteria: CohortCriteriaInput!
}

input CohortUpdateBodyInput {
  name: String = null
  description: String = null
  status: CohortUpdateStatus = null
}

enum CohortUpdateStatus {
  active
  archived
}

type CommentMutations {
  addCommentToThread(parentId: Int!, content: String!): GraphQLComment!
  updateComment(id: Int!, content: String!): GraphQLComment!
  deleteComment(id: Int!): GraphQLComment!
  restoreComment(id: Int!): GraphQLComment!
}

enum CommentStatus {
  active
  deleted
}

type CreatedGraphQLCohort {
  createdCohort: GraphQLCohort!
  excludedIneligibleSgIdsInternal: [String!]
}

"""Date (isoformat)"""
scalar Date

"""Filter for GraphQL queries"""
input DateGraphQLFilter {
  eq: Date = null
  in_: [Date!] = null
  nin: [Date!] = null
  gt: Date = null
  gte: Date = null
  lt: Date = null
  lte: Date = null
  contains: Date = null
  icontains: Date = null
  startswith: Date = null
  isnull: Boolean = null
}

"""Date with time (isoformat)"""
scalar DateTime

"""Filter for GraphQL queries"""
input DatetimeGraphQLFilter {
  eq: DateTime = null
  in_: [DateTime!] = null
  nin: [DateTime!] = null
  gt: DateTime = null
  gte: DateTime = null
  lt: DateTime = null
  lte: DateTime = null
  contains: DateTime = null
  icontains: DateTime = null
  startswith: DateTime = null
  isnull: Boolean = null
}

type FamilyMutations {
  addComment(content: String!, id: Int!): GraphQLComment!
  updateFamily(family: FamilyUpdateInput!): GraphQLFamily!
}

input FamilyUpdateInput {
  id: Int!
  externalIds: JSON = null
  description: String = null
  codedPhenotype: String = null
  meta: JSON = null
}

type GraphQLAnalysis {
  id: Int!
  type: String!
  status: AnalysisStatus!
  output: String
  outputs: JSON
  timestampCompleted: DateTime
  active: Boolean!
  meta: JSON
  sequencingGroups: [GraphQLSequencingGroup!]!
  project: GraphQLProject!
  auditLogs: [GraphQLAuditLog!]!
}

type GraphQLAnalysisRunner {
  arGuid: String!
  outputPath: String!
  timestamp: DateTime!
  accessLevel: String!
  repository: String!
  commit: String!
  script: String!
  description: String!
  driverImage: String!
  configPath: String
  cwd: String
  environment: String!
  hailVersion: String
  batchUrl: String!
  submittingUser: String!
  meta: JSON!
  project: GraphQLProject!
}

type GraphQLAssay {
  id: Int!
  type: String!
  meta: JSON!
  externalIds: JSON!
  sample: GraphQLSample!
  discussion: GraphQLDiscussion!
}

type GraphQLAuditLog {
  id: Int!
  author: String!
  timestamp: DateTime!
  arGuid: String
  comment: String
  meta: JSON!
}

type GraphQLCohort {
  id: String!
  name: String!
  description: String!
  author: String!
  status: CohortStatus!
  template: GraphQLCohortTemplate!
  sequencingGroups(activeOnly: BoolGraphQLFilter = null): [GraphQLSequencingGroup!]!
  analyses: [GraphQLAnalysis!]!
  project: GraphQLProject!
}

type GraphQLCohortTemplate {
  id: String!
  name: String!
  description: String!
  criteria: JSON!
  project: GraphQLProject!
}

type GraphQLComment {
  id: Int!
  parentId: Int
  content: String!
  author: String!
  createdAt: DateTime!
  updatedAt: DateTime!
  status: CommentStatus!
  thread: [GraphQLComment!]!
  versions: [GraphQLCommentVersion!]!
  entity: GraphQLCommentEntity!
}

union GraphQLCommentEntity = GraphQLSample | GraphQLAssay | GraphQLSequencingGroup | GraphQLProject | GraphQLParticipant | GraphQLFamily

type GraphQLCommentVersion {
  content: String!
  author: String!
  status: CommentStatus!
  timestamp: DateTime!
}

type GraphQLDiscussion {
  directComments: [GraphQLComment!]!
  relatedComments: [GraphQLComment!]!
}

type GraphQLEnum {
  analysisType: [String!]!
  assayType: [String!]!
  sampleType: [String!]!
  sequencingPlatform: [String!]!
  sequencingTechnology: [String!]!
  sequencingType: [String!]!
}

type GraphQLFamily {
  id: Int!
  externalId: String!
  externalIds: JSON!
  description: String
  codedPhenotype: String
  meta: JSON!
  project: GraphQLProject!
  participants: [GraphQLParticipant!]!
  familyParticipants: [GraphQLFamilyParticipant!]!
  discussion: GraphQLDiscussion!
}

type GraphQLFamilyParticipant {
  affected: Int
  notes: String
  participant: GraphQLParticipant!
  family: GraphQLFamily!
}

type GraphQLMetamistSettings {
  samplePrefix: String!
  cohortPrefix: String!
  sequencingGroupPrefix: String!
  primaryExternalIdName: String!
}

type GraphQLParticipant {
  id: Int!
  externalId: String!
  externalIds: JSON!
  meta: JSON!
  reportedSex: Int
  reportedGender: String
  karyotype: String
  samples(type: StrGraphQLFilter = null, meta: JSON = null, active: BoolGraphQLFilter = null): [GraphQLSample!]!
  phenotypes: JSON!
  families: [GraphQLFamily!]!
  familyParticipants: [GraphQLFamilyParticipant!]!
  project: GraphQLProject!
  auditLog: GraphQLAuditLog
  discussion: GraphQLDiscussion!
}

type GraphQLProject {
  id: Int!
  name: String!
  dataset: String!
  meta: JSON!
  roles: [ProjectMemberRole!]!
  analysisRunner(arGuid: StrGraphQLFilter = null, author: StrGraphQLFilter = null, repository: StrGraphQLFilter = null, accessLevel: StrGraphQLFilter = null, environment: StrGraphQLFilter = null): [GraphQLAnalysisRunner!]!
  pedigree(internalFamilyIds: [Int!] = null, replaceWithParticipantExternalIds: Boolean! = true, replaceWithFamilyExternalIds: Boolean! = true, includeParticipantsNotInFamilies: Boolean! = false, emptyParticipantValue: String = null): [JSON!]!
  families(id: IntGraphQLFilter = null, externalId: StrGraphQLFilter = null, meta: JSON = null): [GraphQLFamily!]!
  participants(id: IntGraphQLFilter = null, externalId: StrGraphQLFilter = null, meta: JSON = null, reportedSex: IntGraphQLFilter = null, reportedGender: StrGraphQLFilter = null, karyotype: StrGraphQLFilter = null): [GraphQLParticipant!]!
  samples(type: StrGraphQLFilter = null, externalId: StrGraphQLFilter = null, id: StrGraphQLFilter = null, meta: JSON = null, parentId: StrGraphQLFilter = null, rootId: StrGraphQLFilter = null): [GraphQLSample!]!
  sequencingGroups(id: StrGraphQLFilter = null, externalId: StrGraphQLFilter = null, type: StrGraphQLFilter = null, technology: StrGraphQLFilter = null, platform: StrGraphQLFilter = null, activeOnly: BoolGraphQLFilter = null): [GraphQLSequencingGroup!]!
  analyses(status: AnalysisStatusGraphQLFilter = null, type: StrGraphQLFilter = null, meta: JSON = null, active: BoolGraphQLFilter = null, timestampCompleted: DatetimeGraphQLFilter = null, ids: IntGraphQLFilter = null): [GraphQLAnalysis!]!
  cohorts(id: StrGraphQLFilter = null, name: StrGraphQLFilter = null, author: StrGraphQLFilter = null, templateId: StrGraphQLFilter = null, timestamp: DatetimeGraphQLFilter = null, status: CohortStatusGraphQLFilter = null): [GraphQLCohort!]!
  discussion: GraphQLDiscussion!
  sequencingGroupHistory: [GraphQLSequencingGroupsByDate!]!
}

type GraphQLSample {
  id: String!
  externalId: String!
  externalIds: JSON!
  active: Boolean!
  meta: JSON!
  type: String!
  participant: GraphQLParticipant
  assays(type: StrGraphQLFilter = null, meta: JSON = null): [GraphQLAssay!]!
  project: GraphQLProject!
  sequencingGroups(id: StrGraphQLFilter = null, type: StrGraphQLFilter = null, technology: StrGraphQLFilter = null, platform: StrGraphQLFilter = null, meta: JSON = null, activeOnly: BoolGraphQLFilter = null): [GraphQLSequencingGroup!]!
  parentSample: GraphQLSample
  rootSample: GraphQLSample
  nestedSamples(type: StrGraphQLFilter = null, meta: JSON = null): [GraphQLSample!]!
  discussion: GraphQLDiscussion!
}

type GraphQLSequencingGroup {
  id: String!
  type: String!
  technology: String!
  platform: String!
  meta: JSON!
  externalIds: JSON!
  archived: Boolean
  sample: GraphQLSample!
  analyses(status: AnalysisStatusGraphQLFilter = null, type: StrGraphQLFilter = null, meta: JSON = null, active: BoolGraphQLFilter = null, project: StrGraphQLFilter = null): [GraphQLAnalysis!]!
  assays: [GraphQLAssay!]!
  discussion: GraphQLDiscussion!
}

type GraphQLSequencingGroupsByDate {
  date: Date!
  type: String!
  technology: String!
  count: Int!
}

type GraphQLViewer {
  username: String!
  projects: [GraphQLProject!]!
}

"""Filter for GraphQL queries"""
input IntGraphQLFilter {
  eq: Int = null
  in_: [Int!] = null
  nin: [Int!] = null
  gt: Int = null
  gte: Int = null
  lt: Int = null
  lte: Int = null
  contains: Int = null
  icontains: Int = null
  startswith: Int = null
  isnull: Boolean = null
}

"""
The `JSON` scalar type represents JSON values as specified by [ECMA-404](https://ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf).
"""
scalar JSON @specifiedBy(url: "https://ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf")

type Mutation {
  project: ProjectMutations!
  comment: CommentMutations!
  assay: AssayMutations!
  analysisRunner: AnalysisRunnerMutations!
  analysis: AnalysisMutations!
  family: FamilyMutations!
  participant: ParticipantMutations!
  sample: SampleMutations!
  sequencingGroup: SequencingGroupMutations!
  cohort: CohortMutations!
}

type ParticipantMutations {
  addComment(content: String!, id: Int!): GraphQLComment!
  updateParticipant(participantId: Int!, participant: ParticipantUpsertInput!): GraphQLParticipant!
  upsertParticipants(project: String!, participants: [ParticipantUpsertInput!]!): [GraphQLParticipant!]!
  updateParticipantFamily(participantId: Int!, oldFamilyId: Int!, newFamilyId: Int!): UpdateParticipantFamilyType!
}

input ParticipantUpsertInput {
  id: Int = null
  externalIds: JSON = null
  reportedSex: Int = null
  reportedGender: String = null
  karyotype: String = null
  meta: JSON = null
  phenotypes: JSON = null
  samples: [SampleUpsertInput!] = null
}

enum ProjectMemberRole {
  reader
  contributor
  writer
  project_admin
  project_member_admin
}

input ProjectMemberUpdateInput {
  member: String!
  roles: [String!]!
}

type ProjectMutations {
  addComment(content: String!, id: Int!): GraphQLComment!
  createProject(name: String!, dataset: String!, createTestProject: Boolean!): GraphQLProject!
  updateProject(project: String!, projectUpdateModel: JSON!): GraphQLProject!
  updateProjectMembers(project: String!, members: [ProjectMemberUpdateInput!]!): GraphQLProject!
}

type Query {
  enum: GraphQLEnum!
  metamistSettings: GraphQLMetamistSettings!
  viewer: GraphQLViewer!
  cohortTemplates(id: StrGraphQLFilter = null, project: StrGraphQLFilter = null): [GraphQLCohortTemplate!]!
  cohorts(id: StrGraphQLFilter = null, project: StrGraphQLFilter = null, name: StrGraphQLFilter = null, author: StrGraphQLFilter = null, templateId: StrGraphQLFilter = null, status: CohortStatusGraphQLFilter = null): [GraphQLCohort!]!
  project(name: String!): GraphQLProject!
  sample(id: StrGraphQLFilter = null, project: StrGraphQLFilter = null, type: StrGraphQLFilter = null, meta: JSON = null, externalId: StrGraphQLFilter = null, participantId: IntGraphQLFilter = null, active: BoolGraphQLFilter = null, parentId: StrGraphQLFilter = null, rootId: StrGraphQLFilter = null): [GraphQLSample!]!
  sequencingGroups(id: StrGraphQLFilter = null, project: StrGraphQLFilter = null, sampleId: StrGraphQLFilter = null, type: StrGraphQLFilter = null, technology: StrGraphQLFilter = null, platform: StrGraphQLFilter = null, activeOnly: BoolGraphQLFilter = null, createdOn: DateGraphQLFilter = null, assayMeta: JSON = null, hasCram: Boolean = null, hasGvcf: Boolean = null): [GraphQLSequencingGroup!]!
  assay(id: Int!): GraphQLAssay!
  participant(id: Int!): GraphQLParticipant!
  family(familyId: Int!): GraphQLFamily!
  myProjects: [GraphQLProject!]!
  analysisRunner(arGuid: String!): GraphQLAnalysisRunner!
  analyses(id: IntGraphQLFilter!): [GraphQLAnalysis!]!
}

type SampleMutations {
  addComment(content: String!, id: String!): GraphQLComment!
  createSample(project: String!, sample: SampleUpsertInput!): GraphQLSample!
  upsertSamples(project: String!, samples: [SampleUpsertInput!]!): [GraphQLSample!]
  updateSample(sample: SampleUpsertInput!): GraphQLSample!
}

input SampleUpsertInput {
  id: String = null
  externalIds: JSON = null
  meta: JSON = null
  project: Int = null
  type: String = null
  participantId: Int = null
  active: Boolean = null
  sequencingGroups: [SequencingGroupUpsertInput!] = null
  nonSequencingAssays: [AssayUpsertInput!] = null
}

input SequencingGroupMetaUpdateInput {
  id: String = null
  meta: JSON = null
}

type SequencingGroupMutations {
  addComment(content: String!, id: String!): GraphQLComment!
  updateSequencingGroup(project: String!, sequencingGroup: SequencingGroupMetaUpdateInput!): GraphQLSequencingGroup!
  archiveSequencingGroups(sequencingGroupIds: [String!]!): [GraphQLSequencingGroup!]!
}

input SequencingGroupUpsertInput {
  id: String = null
  type: String = null
  technology: String = null
  platform: String = null
  meta: JSON = null
  sampleId: String = null
  externalIds: JSON = null
  assays: [AssayUpsertInput!] = null
}

"""Filter for GraphQL queries"""
input StrGraphQLFilter {
  eq: String = null
  in_: [String!] = null
  nin: [String!] = null
  gt: String = null
  gte: String = null
  lt: String = null
  lte: String = null
  contains: String = null
  icontains: String = null
  startswith: String = null
  isnull: Boolean = null
}

type UpdateParticipantFamilyType {
  familyId: Int!
  participantId: Int!
}
