// @generated by eql-codegen from the eql-domains catalog — do not edit
//! The `smallint` 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.smallint` — 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 Smallint {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
}
impl DomainType for Smallint {
    fn sql_domain_static() -> &'static str {
        "eql_v3.smallint"
    }
    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> {
        Smallint::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(Smallint)
    }
}
/// `eql_v3.smallint_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 SmallintEq {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
    pub hm: Hmac256,
}
impl DomainType for SmallintEq {
    fn sql_domain_static() -> &'static str {
        "eql_v3.smallint_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> {
        SmallintEq::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(SmallintEq)
    }
}
/// `eql_v3.smallint_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 SmallintOrdOre {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
    pub ob: OreBlock256,
}
impl DomainType for SmallintOrdOre {
    fn sql_domain_static() -> &'static str {
        "eql_v3.smallint_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> {
        SmallintOrdOre::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(SmallintOrdOre)
    }
}
/// `eql_v3.smallint_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 SmallintOrd {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
    pub ob: OreBlock256,
}
impl DomainType for SmallintOrd {
    fn sql_domain_static() -> &'static str {
        "eql_v3.smallint_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> {
        SmallintOrd::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(SmallintOrd)
    }
}
/// `eql_v3.smallint_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 SmallintOrdOpe {
    pub v: SchemaVersion,
    pub i: Identifier,
    pub c: Ciphertext,
    pub op: OpeCllw,
}
impl DomainType for SmallintOrdOpe {
    fn sql_domain_static() -> &'static str {
        "eql_v3.smallint_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> {
        SmallintOrdOpe::deserialize(value).map(|_| ())
    }
    fn schema(&self) -> Schema {
        schema_for!(SmallintOrdOpe)
    }
}
