// @generated by eql-codegen from the eql-domains catalog — do not edit
//! The `double` encrypted-domain family — generated from the eql-domains catalog.
use crate::v3::terms::{Ciphertext, Hmac256, OpeCllw, OreBlock256};
use crate::v3::DomainType;
use crate::{Identifier, SchemaVersion};
use schemars::{schema_for, JsonSchema, Schema};
use serde::{Deserialize, Serialize};
use ts_rs::TS;
/// `eql_v3.double` — storage-only domain.
///
/// Operators: none. Required keys: `v` `i` `c`.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TS, JsonSchema)]
#[ts(export, export_to = "v3/")]
#[serde(deny_unknown_fields)]
pub struct Double {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
}
impl DomainType for Double {
    fn sql_domain_static() -> &'static str {
        "eql_v3.double"
    }
    fn sql_domain(&self) -> &'static str {
        Self::sql_domain_static()
    }
    fn term_json_keys_static() -> Option<&'static [&'static str]> {
        Some(&[])
    }
    fn term_json_keys(&self) -> Option<&'static [&'static str]> {
        Self::term_json_keys_static()
    }
    fn parse_value(&self, value: &serde_json::Value) -> Result<(), serde_json::Error> {
        Double::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(Double)
    }
}
/// `eql_v3.double_eq` — equality domain.
///
/// Operators: `=` `<>`. Required keys: `v` `i` `c` `hm`.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TS, JsonSchema)]
#[ts(export, export_to = "v3/")]
#[serde(deny_unknown_fields)]
pub struct DoubleEq {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
    pub hm: Hmac256,
}
impl DomainType for DoubleEq {
    fn sql_domain_static() -> &'static str {
        "eql_v3.double_eq"
    }
    fn sql_domain(&self) -> &'static str {
        Self::sql_domain_static()
    }
    fn term_json_keys_static() -> Option<&'static [&'static str]> {
        Some(&["hm"])
    }
    fn term_json_keys(&self) -> Option<&'static [&'static str]> {
        Self::term_json_keys_static()
    }
    fn parse_value(&self, value: &serde_json::Value) -> Result<(), serde_json::Error> {
        DoubleEq::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(DoubleEq)
    }
}
/// `eql_v3.double_ord_ore` — ordering domain.
///
/// Operators: `=` `<>` `<` `<=` `>` `>=`. Required keys: `v` `i` `c` `ob`.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TS, JsonSchema)]
#[ts(export, export_to = "v3/")]
#[serde(deny_unknown_fields)]
pub struct DoubleOrdOre {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
    pub ob: OreBlock256,
}
impl DomainType for DoubleOrdOre {
    fn sql_domain_static() -> &'static str {
        "eql_v3.double_ord_ore"
    }
    fn sql_domain(&self) -> &'static str {
        Self::sql_domain_static()
    }
    fn term_json_keys_static() -> Option<&'static [&'static str]> {
        Some(&["ob"])
    }
    fn term_json_keys(&self) -> Option<&'static [&'static str]> {
        Self::term_json_keys_static()
    }
    fn parse_value(&self, value: &serde_json::Value) -> Result<(), serde_json::Error> {
        DoubleOrdOre::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(DoubleOrdOre)
    }
}
/// `eql_v3.double_ord` — ordering domain.
///
/// Operators: `=` `<>` `<` `<=` `>` `>=`. Required keys: `v` `i` `c` `ob`.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TS, JsonSchema)]
#[ts(export, export_to = "v3/")]
#[serde(deny_unknown_fields)]
pub struct DoubleOrd {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
    pub ob: OreBlock256,
}
impl DomainType for DoubleOrd {
    fn sql_domain_static() -> &'static str {
        "eql_v3.double_ord"
    }
    fn sql_domain(&self) -> &'static str {
        Self::sql_domain_static()
    }
    fn term_json_keys_static() -> Option<&'static [&'static str]> {
        Some(&["ob"])
    }
    fn term_json_keys(&self) -> Option<&'static [&'static str]> {
        Self::term_json_keys_static()
    }
    fn parse_value(&self, value: &serde_json::Value) -> Result<(), serde_json::Error> {
        DoubleOrd::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(DoubleOrd)
    }
}
/// `eql_v3.double_ord_ope` — ordering domain.
///
/// Operators: `=` `<>` `<` `<=` `>` `>=`. Required keys: `v` `i` `c` `op`.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TS, JsonSchema)]
#[ts(export, export_to = "v3/")]
#[serde(deny_unknown_fields)]
pub struct DoubleOrdOpe {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
    pub op: OpeCllw,
}
impl DomainType for DoubleOrdOpe {
    fn sql_domain_static() -> &'static str {
        "eql_v3.double_ord_ope"
    }
    fn sql_domain(&self) -> &'static str {
        Self::sql_domain_static()
    }
    fn term_json_keys_static() -> Option<&'static [&'static str]> {
        Some(&["op"])
    }
    fn term_json_keys(&self) -> Option<&'static [&'static str]> {
        Self::term_json_keys_static()
    }
    fn parse_value(&self, value: &serde_json::Value) -> Result<(), serde_json::Error> {
        DoubleOrdOpe::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(DoubleOrdOpe)
    }
}
