extend type ActionLogType {
  readReceipt: DateTime
}

extend type EmailType {
  readReceipt: DateTime
}

type IsUnreadType {
  isUnread: Boolean
  teamId: ID!
}

extend type EmailThreadType {
  readReceipt: [IsUnreadType!]!
}

extend type DefinitionChannelType {
  readReceipt: [IsUnreadType!]!
}

extend type Query {
  getEmailDraft(
    teamId: ID!
    instructor: Boolean!
    emailThreadId: ID
  ): EmailDraftType
  getEmailDrafts(teamId: ID!, instructor: Boolean!): [EmailDraftType]
}

extend type Mutation {
  writeReadReceipt(actionLogId: ID!): ReadReceiptType
  writeReadReceiptEmail(emailId: ID!): EmailReceipt
  setEmailDraft(emailDraft: EmailDraftInput!): EmailDraftType
  deleteEmailDraft(
    teamId: ID!
    instructor: Boolean!
    emailThreadId: ID
  ): MutationResult
  setIsUnreadEmailThread(
    threadId: ID!
    teamId: ID!
    isUnread: Boolean!
  ): MutationResult
  setIsUnreadChannel(
    channelId: ID!
    teamId: ID!
    isUnread: Boolean!
  ): MutationResult
}

type MutationResult {
  operationDone: Boolean
}

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

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

type EmailReceipt {
  emailId: ID!
  readReceipt: DateTime
}

type ReadReceiptType {
  actionLogId: ID!
  readReceipt: DateTime
}

type ChannelReceipt {
  channelId: ID!
  teamId: ID!
  readReceipt: DateTime
}
