use crate::query_planner::{
ast::{
operation::{PlanningFetchOperation, SubgraphFetchOperation},
selection_set::SelectionSet,
},
utils::pretty_display::PrettyDisplay,
};
use serde::{de::DeserializeOwned, Serialize};
use std::fmt::Debug;
pub trait PlanState: private::Sealed + Debug + Clone {
type Operation: Debug
+ Clone
+ Serialize
+ DeserializeOwned
+ PrettyDisplay
+ AsRef<SubgraphFetchOperation>;
type Requires: Debug + Clone + Default;
}
#[derive(Debug, Clone)]
pub struct Planning;
#[derive(Debug, Clone)]
pub struct Executable;
impl PlanState for Planning {
type Operation = PlanningFetchOperation;
type Requires = Option<Box<SelectionSet>>;
}
impl PlanState for Executable {
type Operation = SubgraphFetchOperation;
type Requires = ();
}
mod private {
pub trait Sealed {}
impl Sealed for super::Planning {}
impl Sealed for super::Executable {}
}