use crate::loc;
use crate::schema::Schema;
use crate::Value;
use crate::types::Directive;
use crate::types::NamedDirectiveRef;
use indexmap::IndexMap;
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct DirectiveAnnotation {
pub(crate) arguments: IndexMap<String, Value>,
pub(crate) directive_ref: NamedDirectiveRef,
}
impl DirectiveAnnotation {
pub fn arguments(&self) -> &IndexMap<String, Value> {
&self.arguments
}
pub fn def_location(&self) -> &loc::SourceLocation {
self.directive_ref.ref_location()
}
pub fn directive_type<'schema>(
&self,
schema: &'schema Schema,
) -> &'schema Directive {
self.directive_ref.deref(schema).unwrap()
}
pub fn directive_type_name(&self) -> &str {
self.directive_ref.name()
}
}