enum NotificationType {
    UNREAD
    ARCHIVE
}

input NotificationFilter {
    importance: Importance
    type: NotificationType
    offset: Int!
    limit: Int!
}

type Query {
    notifications: Notifications!
}

type Mutation {
    createNotification(input: NotificationData!): Notification!
    deleteNotification(id: String!, type: NotificationType!): NotificationOverview!
    """
    Deletes all archived notifications on server.
    """
    deleteArchivedNotifications: NotificationOverview!
    """
    Marks a notification as archived.
    """
    archiveNotification(id: String!): Notification!
    """
    Marks a notification as unread.
    """
    unreadNotification(id: String!): Notification!
    archiveNotifications(ids: [String!]): NotificationOverview!
    unarchiveNotifications(ids: [String!]): NotificationOverview!
    archiveAll(importance: Importance): NotificationOverview!
    unarchiveAll(importance: Importance): NotificationOverview!
    """
    Reads each notification to recompute & update the overview.
    """
    recalculateOverview: NotificationOverview!
}

type Subscription {
    notificationAdded: Notification!
    notificationsOverview: NotificationOverview!
}

enum Importance {
    ALERT
    INFO
    WARNING
}

type Notifications implements Node {
    id: ID!
    """
    A cached overview of the notifications in the system & their severity.
    """
    overview: NotificationOverview!
    list(filter: NotificationFilter!): [Notification!]!
}

type Notification implements Node {
    id: ID!
    """
    Also known as 'event'
    """
    title: String!
    subject: String!
    description: String!
    importance: Importance!
    link: String
    type: NotificationType!
    """
    ISO Timestamp for when the notification occurred
    """
    timestamp: String
    formattedTimestamp: String
}

input NotificationData {
    title: String!
    subject: String!
    description: String!
    importance: Importance!
    link: String
}

type NotificationOverview {
    unread: NotificationCounts!
    archive: NotificationCounts!
}

type NotificationCounts {
    info: Int!
    warning: Int!
    alert: Int!
    total: Int!
}
