use indexmap::IndexMap;
use serde::{Deserialize, Serialize};
use super::ir::TypeReference;
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct OperationDirectiveArgs {
pub directive_name: String,
pub arguments: IndexMap<String, serde_json::Value>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum OperationType {
Query,
Mutation,
Subscription,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct OperationArgument {
pub name: String,
pub r#type: TypeReference,
#[serde(skip_serializing_if = "Option::is_none")]
pub default_value: Option<serde_json::Value>,
pub directives: IndexMap<String, serde_json::Value>,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SchemaOperation {
pub operation_type: OperationType,
pub root_type_name: String,
pub field_name: String,
pub arguments: Vec<OperationArgument>,
pub result_type: TypeReference,
pub directives: IndexMap<String, serde_json::Value>,
}