const gql = require('graphql-tag')

const typeDef = gql`
  type Notification {
    id: ID!
    type: String
    detail: JSON
    message: String
    created: DateTimeISO
    read: Boolean
    valid: Boolean
  }

  type Query {
    notifications: [Notification] @auth
    alerts: [Notification] @auth
    hasUnreadNotifications: Boolean @auth
  }

  type Mutation {
    toggleClearNotification(id: ID!, read: Boolean!): Notification @auth
    clearAllNotifications: Notification @auth
  }
`

module.exports = typeDef
