1# frozen_string_literal: true
2
3module Types
4  module Metrics
5    module Dashboards
6      class AnnotationType < ::Types::BaseObject
7        authorize :read_metrics_dashboard_annotation
8        graphql_name 'MetricsDashboardAnnotation'
9
10        field :description, GraphQL::Types::String, null: true,
11              description: 'Description of the annotation.'
12
13        field :id, GraphQL::Types::ID, null: false,
14              description: 'ID of the annotation.'
15
16        field :panel_id, GraphQL::Types::String, null: true,
17              description: 'ID of a dashboard panel to which the annotation should be scoped.'
18
19        field :starting_at, Types::TimeType, null: true,
20              description: 'Timestamp marking start of annotated time span.'
21
22        field :ending_at, Types::TimeType, null: true,
23              description: 'Timestamp marking end of annotated time span.'
24
25        def panel_id
26          object.panel_xid
27        end
28      end
29    end
30  end
31end
32