Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

993 B
Raw Blame
//! Valued Intermediate Representation
use serde::{Deserialize, Serialize};

use crate::types::{EuclidValue, Metadata};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ValuedComparisonLogic {
    NegativeConjunction,
    PositiveDisjunction,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ValuedComparison {
    pub values: Vec<EuclidValue>,
    pub logic: ValuedComparisonLogic,
    pub metadata: Metadata,
}

pub type ValuedIfCondition = Vec<ValuedComparison>;

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ValuedIfStatement {
    pub condition: ValuedIfCondition,
    pub nested: Option<Vec<Self>>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ValuedRule<O> {
    pub name: String,
    pub connector_selection: O,
    pub statements: Vec<ValuedIfStatement>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ValuedProgram<O> {
    pub default_selection: O,
    pub rules: Vec<ValuedRule<O>>,
    pub metadata: Metadata,
}