use std::collections::HashSet;
use crate::{Enum, Object, model::__InputValue, registry};
#[derive(Debug, Enum, Copy, Clone, Eq, PartialEq)]
#[graphql(internal, name = "__DirectiveLocation")]
#[allow(non_camel_case_types)]
pub enum __DirectiveLocation {
QUERY,
MUTATION,
SUBSCRIPTION,
FIELD,
FRAGMENT_DEFINITION,
FRAGMENT_SPREAD,
INLINE_FRAGMENT,
VARIABLE_DEFINITION,
SCHEMA,
SCALAR,
OBJECT,
FIELD_DEFINITION,
ARGUMENT_DEFINITION,
INTERFACE,
UNION,
ENUM,
ENUM_VALUE,
INPUT_OBJECT,
INPUT_FIELD_DEFINITION,
}
#[doc(hidden)]
#[allow(non_camel_case_types)]
pub mod location_traits {
pub trait Directive_At_FIELD_DEFINITION {
fn check() {}
}
pub trait Directive_At_OBJECT {
fn check() {}
}
pub trait Directive_At_INPUT_FIELD_DEFINITION {
fn check() {}
}
pub trait Directive_At_ARGUMENT_DEFINITION {
fn check() {}
}
pub trait Directive_At_INPUT_OBJECT {
fn check() {}
}
pub trait Directive_At_INTERFACE {
fn check() {}
}
pub trait Directive_At_ENUM {
fn check() {}
}
pub trait Directive_At_ENUM_VALUE {
fn check() {}
}
}
pub struct __Directive<'a> {
pub registry: &'a registry::Registry,
pub visible_types: &'a HashSet<&'a str>,
pub directive: &'a registry::MetaDirective,
}
#[Object(internal, name = "__Directive")]
impl<'a> __Directive<'a> {
#[inline]
async fn name(&self) -> &str {
&self.directive.name
}
#[inline]
async fn description(&self) -> Option<&str> {
self.directive.description.as_deref()
}
#[inline]
async fn locations(&self) -> &Vec<__DirectiveLocation> {
&self.directive.locations
}
async fn args(
&self,
#[graphql(default = false)] include_deprecated: bool,
) -> Vec<__InputValue<'a>> {
self.directive
.args
.values()
.filter(|input_value| include_deprecated || !input_value.deprecation.is_deprecated())
.map(|input_value| __InputValue {
registry: self.registry,
visible_types: self.visible_types,
input_value,
})
.collect()
}
#[inline]
async fn is_repeatable(&self) -> bool {
self.directive.is_repeatable
}
}