use crate::input::yaml;
use crate::output::extension;
use crate::output::type_system::meta;
use std::collections::HashMap;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct Definition {
pub extension_id: u64,
pub common: Arc<Common>,
pub compound_name: String,
pub arguments: Vec<ArgumentSlot>,
pub options: HashMap<OptionName, OptionValues>,
pub variadic: VariadicBehavior,
pub session_dependent: bool,
pub deterministic: bool,
pub nullability_handling: NullabilityHandling,
pub return_type: meta::Program,
pub implementations: HashMap<String, yaml::Value>,
}
#[derive(Clone, Debug)]
pub struct Common {
pub name: String,
pub description: Option<String>,
pub function_type: Type,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Type {
Scalar,
Aggregate,
Window,
}
#[derive(Clone, Debug)]
pub struct ArgumentSlot {
pub name: Option<String>,
pub description: Option<String>,
pub argument_type: ArgumentSlotType,
}
#[derive(Clone, Debug)]
pub enum ArgumentSlotType {
Value(ValueArgumentSlot),
Type(TypeArgumentSlot),
Enumeration(EnumerationArgumentSlot),
}
#[derive(Clone, Debug)]
pub struct ValueArgumentSlot {
pub pattern: meta::pattern::Value,
pub constant: bool,
}
#[derive(Clone, Debug)]
pub struct TypeArgumentSlot {
pub pattern: meta::pattern::Value,
}
#[derive(Clone, Debug)]
pub struct EnumerationArgumentSlot {
pub options: Vec<String>,
pub required: bool,
}
#[derive(Clone, Debug)]
pub struct OptionName {
pub name: String,
}
#[derive(Clone, Debug)]
pub struct OptionValues {
pub values: Vec<String>,
}
#[derive(Clone, Debug)]
pub struct VariadicBehavior {
pub parameter_consistency: ParameterConsistency,
pub min: usize,
pub max: usize,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ParameterConsistency {
Consistent,
Inconsistent,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NullabilityHandling {
Mirror,
DeclaredOutput,
Discrete,
}
pub type NamespaceReference = extension::namespace::Reference<Definition>;
pub type NamespaceDefinition = extension::namespace::Definition<Definition>;
pub type UnresolvedReference = extension::reference::Data<Definition>;
pub type ResolutionResult = extension::namespace::ResolutionResult<Definition>;
pub type Reference = extension::Reference<Definition>;