noie-nds-api 3.0.3

NDS Protocol Buffers types for Rust (generated from nds-api/spec).
Documentation
// @generated
// This file is @generated by prost-build.
// ============================================================================
// \[Index\] NDS-PROTO-COMMON-010 Decimal
// ============================================================================

/// \[Semantic\] High-precision decimal value.
/// \[Constraint\] Proto has no native BigDecimal; encode as string to preserve exactness.
/// \[Behavior\] Each language SDK MUST convert to its native precise decimal type via adapters.
/// \[Trace\] Java: BigDecimal; C#: decimal; TypeScript: string (or decimal.js).
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Decimal {
    /// String representation (e.g. "1234.56", "-100.00").
    #[prost(string, tag="1")]
    pub value: ::prost::alloc::string::String,
    /// Scale (optional; used for validation/formatting).
    #[prost(int32, tag="2")]
    pub scale: i32,
}
// ============================================================================
// \[Index\] NDS-PROTO-COMMON-020 Result
// ============================================================================

/// \[Semantic\] Standard success/failure envelope.
/// \[Behavior\] Business failures MUST be expressed via `success=false` with `error`.
/// \[Trace\] RPC responses embed NdsResult as the primary outcome indicator.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NdsResult {
    /// Whether the operation succeeded.
    #[prost(bool, tag="1")]
    pub success: bool,
    /// Error object (valid only when success=false).
    #[prost(message, optional, tag="2")]
    pub error: ::core::option::Option<NdsError>,
}
/// \[Semantic\] Structured error details.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NdsError {
    /// Machine-readable error code (e.g. "INSUFFICIENT_BALANCE").
    #[prost(string, tag="1")]
    pub code: ::prost::alloc::string::String,
    /// Human-readable message.
    #[prost(string, tag="2")]
    pub message: ::prost::alloc::string::String,
    /// Optional details for debugging/logging.
    #[prost(map="string, string", tag="3")]
    pub details: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
// ============================================================================
// \[Index\] NDS-PROTO-COMMON-040 Metadata
// ============================================================================

/// \[Semantic\] Generic metadata container for extensible key-value pairs.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Metadata {
    /// Metadata entries.
    #[prost(map="string, string", tag="1")]
    pub entries: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
// ============================================================================
// \[Index\] NDS-PROTO-COMMON-030 ErrorCode
// ============================================================================

/// \[Semantic\] Standardized error codes. SDKs MAY extend, but SHOULD not repurpose existing values.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ErrorCode {
    /// Unknown error (default).
    Unspecified = 0,
    // ===== Asset =====

    /// Asset not found.
    AssetNotFound = 1,
    /// Asset already exists.
    AssetAlreadyExists = 2,
    /// Insufficient balance.
    InsufficientBalance = 3,
    /// Asset limit exceeded.
    AssetLimitExceeded = 4,
    // ===== Identity =====

    /// Identity not found.
    IdentityNotFound = 10,
    /// Invalid identity.
    IdentityInvalid = 11,
    // ===== Transaction =====

    /// Transaction failed.
    TransactionFailed = 20,
    /// Transaction rolled back.
    TransactionRolledBack = 21,
    /// Consistency violation.
    ConsistencyViolation = 22,
    // ===== System =====

    /// System not initialized.
    SystemNotInitialized = 30,
    /// System error.
    SystemError = 31,
    /// Timeout.
    Timeout = 32,
    // ===== Validation =====

    /// Invalid argument.
    InvalidArgument = 40,
    /// Permission denied.
    PermissionDenied = 41,
    // ===== Policy / Governance =====

    /// Policy violation.
    PolicyViolation = 42,
    /// Rationale required.
    RationaleRequired = 43,
}
impl ErrorCode {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ERROR_CODE_UNSPECIFIED",
            Self::AssetNotFound => "ERROR_CODE_ASSET_NOT_FOUND",
            Self::AssetAlreadyExists => "ERROR_CODE_ASSET_ALREADY_EXISTS",
            Self::InsufficientBalance => "ERROR_CODE_INSUFFICIENT_BALANCE",
            Self::AssetLimitExceeded => "ERROR_CODE_ASSET_LIMIT_EXCEEDED",
            Self::IdentityNotFound => "ERROR_CODE_IDENTITY_NOT_FOUND",
            Self::IdentityInvalid => "ERROR_CODE_IDENTITY_INVALID",
            Self::TransactionFailed => "ERROR_CODE_TRANSACTION_FAILED",
            Self::TransactionRolledBack => "ERROR_CODE_TRANSACTION_ROLLED_BACK",
            Self::ConsistencyViolation => "ERROR_CODE_CONSISTENCY_VIOLATION",
            Self::SystemNotInitialized => "ERROR_CODE_SYSTEM_NOT_INITIALIZED",
            Self::SystemError => "ERROR_CODE_SYSTEM_ERROR",
            Self::Timeout => "ERROR_CODE_TIMEOUT",
            Self::InvalidArgument => "ERROR_CODE_INVALID_ARGUMENT",
            Self::PermissionDenied => "ERROR_CODE_PERMISSION_DENIED",
            Self::PolicyViolation => "ERROR_CODE_POLICY_VIOLATION",
            Self::RationaleRequired => "ERROR_CODE_RATIONALE_REQUIRED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ERROR_CODE_UNSPECIFIED" => Some(Self::Unspecified),
            "ERROR_CODE_ASSET_NOT_FOUND" => Some(Self::AssetNotFound),
            "ERROR_CODE_ASSET_ALREADY_EXISTS" => Some(Self::AssetAlreadyExists),
            "ERROR_CODE_INSUFFICIENT_BALANCE" => Some(Self::InsufficientBalance),
            "ERROR_CODE_ASSET_LIMIT_EXCEEDED" => Some(Self::AssetLimitExceeded),
            "ERROR_CODE_IDENTITY_NOT_FOUND" => Some(Self::IdentityNotFound),
            "ERROR_CODE_IDENTITY_INVALID" => Some(Self::IdentityInvalid),
            "ERROR_CODE_TRANSACTION_FAILED" => Some(Self::TransactionFailed),
            "ERROR_CODE_TRANSACTION_ROLLED_BACK" => Some(Self::TransactionRolledBack),
            "ERROR_CODE_CONSISTENCY_VIOLATION" => Some(Self::ConsistencyViolation),
            "ERROR_CODE_SYSTEM_NOT_INITIALIZED" => Some(Self::SystemNotInitialized),
            "ERROR_CODE_SYSTEM_ERROR" => Some(Self::SystemError),
            "ERROR_CODE_TIMEOUT" => Some(Self::Timeout),
            "ERROR_CODE_INVALID_ARGUMENT" => Some(Self::InvalidArgument),
            "ERROR_CODE_PERMISSION_DENIED" => Some(Self::PermissionDenied),
            "ERROR_CODE_POLICY_VIOLATION" => Some(Self::PolicyViolation),
            "ERROR_CODE_RATIONALE_REQUIRED" => Some(Self::RationaleRequired),
            _ => None,
        }
    }
}
// @@protoc_insertion_point(module)