type NOTIFIED {
  id: ID!
  from: NotificationSource
  to: User
  createdAt: String!
  updatedAt: String!
  read: Boolean
  reason: NotificationReason
  relatedUser: User
}

union NotificationSource = Post | Comment | Group

enum NotificationOrdering {
  createdAt_asc
  createdAt_desc
  updatedAt_asc
  updatedAt_desc
}

enum NotificationReason {
  mentioned_in_post
  mentioned_in_comment
  commented_on_post
  user_joined_group
  user_left_group
  changed_group_member_role
  removed_user_from_group
}

type Query {
  notifications(read: Boolean, orderBy: NotificationOrdering, first: Int, offset: Int): [NOTIFIED]
}
  
type Mutation {
  markAsRead(id: ID!): NOTIFIED
  markAllAsRead: [NOTIFIED]
}

type Subscription {
  notificationAdded: NOTIFIED
}
