1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use crate::executable::{
    AbstractExecutableDefinition, AbstractOperationDefinition, AbstractSelection,
    ExplicitOperationDefinition, Field, FragmentDefinition, FragmentSpread,
    ImplicitOperationDefinition, InlineFragment, SelectionSet, VariableDefinition,
    VariableDefinitions,
};
use crate::{
    AbstractTypeReference, AbstractValue, Argument, Arguments, Directive, Directives, Variable,
};

pub trait ExecutableDocument {
    type Variable: Variable;
    type Value<const CONST: bool>: AbstractValue<CONST>;
    type TypeReference: AbstractTypeReference;
    type Argument<const CONST: bool>: Argument<CONST, Value = Self::Value<CONST>>;
    type Arguments<const CONST: bool>: Arguments<CONST, Argument = Self::Argument<CONST>>;
    type Directive<const CONST: bool>: Directive<CONST, Arguments = Self::Arguments<CONST>>;
    type Directives<const CONST: bool>: Directives<CONST, Directive = Self::Directive<CONST>>;
    type FragmentSpread: FragmentSpread<Directives = Self::Directives<false>>;
    type Field: Field<
        Arguments = Self::Arguments<false>,
        Directives = Self::Directives<false>,
        SelectionSet = Self::SelectionSet,
    >;
    type Selection: AbstractSelection<
        Field = Self::Field,
        FragmentSpread = Self::FragmentSpread,
        InlineFragment = Self::InlineFragment,
    >;
    type SelectionSet: SelectionSet<Selection = Self::Selection>;
    type InlineFragment: InlineFragment<
        Directives = Self::Directives<false>,
        SelectionSet = Self::SelectionSet,
    >;
    type VariableDefinition: VariableDefinition<
        Variable = Self::Variable,
        TypeReference = Self::TypeReference,
        Directives = Self::Directives<true>,
        Value = Self::Value<true>,
    >;
    type VariableDefinitions: VariableDefinitions<VariableDefinition = Self::VariableDefinition>;
    type ExplicitOperationDefinition: ExplicitOperationDefinition<
        VariableDefinitions = Self::VariableDefinitions,
        Directives = Self::Directives<false>,
        SelectionSet = Self::SelectionSet,
    >;
    type ImplicitOperationDefinition: ImplicitOperationDefinition<SelectionSet = Self::SelectionSet>;
    type OperationDefinition: AbstractOperationDefinition<
        ExplicitOperationDefinition = Self::ExplicitOperationDefinition,
        ImplicitOperationDefinition = Self::ImplicitOperationDefinition,
    >;
    type FragmentDefinition: FragmentDefinition<
        Directives = Self::Directives<false>,
        SelectionSet = Self::SelectionSet,
    >;
    type ExecutableDefinition: AbstractExecutableDefinition<
        OperationDefinition = Self::OperationDefinition,
        FragmentDefinition = Self::FragmentDefinition,
    >;

    fn operation_definitions(&self) -> &[Self::OperationDefinition];
    fn fragment_definitions(&self) -> &[Self::FragmentDefinition];
}