// This file is @generated by prost-build. /// Exact inputs for a conversion preview. Decimal values are strings so the /// client never loses precision through binary floating point. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct PreviewEcbConversionRequest { #[prost(string, tag = "1")] pub original_amount: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub original_currency: ::prost::alloc::string::String, #[prost(enumeration = "EcbConversionContext", tag = "3")] pub conversion_context: i32, /// ISO calendar date (YYYY-MM-DD). Its meaning is selected by /// conversion_context: transaction, statement, or decisive date. #[prost(string, tag = "4")] pub anchor_date: ::prost::alloc::string::String, /// Required. Profile whose rates apply. Only consulted when use_custom_rate is /// set, but always required so a preview names the books it describes. #[prost(string, tag = "5")] pub profile_name: ::prost::alloc::string::String, /// Preview the profile's own rate for the publication date rather than the ECB /// reference rate. Must match what the posting will ask for, or the preview /// describes a conversion that will not happen. #[prost(bool, tag = "6")] pub use_custom_rate: bool, } /// The conversion and immutable local ECB observation that would be used now. /// No rounding is performed and no conversion evidence is persisted. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct PreviewEcbConversionResponse { #[prost(string, tag = "1")] pub original_amount: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub original_currency: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub eur_amount: ::prost::alloc::string::String, #[prost(enumeration = "EcbConversionContext", tag = "4")] pub conversion_context: i32, #[prost(string, tag = "5")] pub anchor_date: ::prost::alloc::string::String, #[prost(string, tag = "6")] pub determination_method: ::prost::alloc::string::String, #[prost(string, tag = "7")] pub rounding_method: ::prost::alloc::string::String, #[prost(string, optional, tag = "8")] pub rate_date: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, optional, tag = "9")] pub units_per_eur: ::core::option::Option<::prost::alloc::string::String>, #[prost(int64, optional, tag = "10")] pub rate_observation_id: ::core::option::Option, #[prost(string, optional, tag = "11")] pub observation_hash: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, optional, tag = "12")] pub source_payload_hash: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, optional, tag = "13")] pub rate_fetched_at: ::core::option::Option<::prost::alloc::string::String>, #[prost(int64, optional, tag = "14")] pub import_batch_id: ::core::option::Option, #[prost(string, optional, tag = "15")] pub source_endpoint: ::core::option::Option<::prost::alloc::string::String>, /// Present only when determination_method is custom_rate. rate_date and /// units_per_eur then describe the hand-entered row identified here, and the /// ECB observation fields above are empty. #[prost(int64, optional, tag = "16")] pub custom_rate_table_definition_id: ::core::option::Option, #[prost(int64, optional, tag = "17")] pub custom_rate_record_id: ::core::option::Option, #[prost(int64, optional, tag = "18")] pub custom_rate_row_revision: ::core::option::Option, #[prost(string, optional, tag = "19")] pub custom_rate_note: ::core::option::Option<::prost::alloc::string::String>, } /// Identify one logical money cell whose conversion history should be inspected. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct ListEcbConversionEvidenceRequest { /// Required. Profile containing the table. #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, /// Required. Logical table name within the profile. #[prost(string, tag = "2")] pub table_name: ::prost::alloc::string::String, /// Required. Dynamic table row id. #[prost(int64, tag = "3")] pub record_id: i64, /// Required. Current display name of the money column. The server resolves it /// to the stable physical column name used by immutable evidence. #[prost(string, tag = "4")] pub column_name: ::prost::alloc::string::String, /// Optional. Maximum rows to return. Zero uses 100; maximum is 500. #[prost(int32, tag = "5")] pub limit: i32, /// Optional cursor. Return evidence ids lower than this value. #[prost(int64, optional, tag = "6")] pub before_evidence_id: ::core::option::Option, } /// One immutable explanation of how a posted EUR value was determined. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct EcbConversionEvidence { #[prost(int64, tag = "1")] pub evidence_id: i64, /// Exact committed version of the target dynamic-table row. #[prost(int64, tag = "2")] pub row_revision: i64, #[prost(string, tag = "3")] pub original_amount: ::prost::alloc::string::String, #[prost(string, tag = "4")] pub original_currency: ::prost::alloc::string::String, #[prost(string, tag = "5")] pub eur_amount: ::prost::alloc::string::String, #[prost(string, tag = "6")] pub conversion_context: ::prost::alloc::string::String, #[prost(string, tag = "7")] pub anchor_date: ::prost::alloc::string::String, #[prost(string, tag = "8")] pub determination_method: ::prost::alloc::string::String, #[prost(string, tag = "9")] pub rounding_method: ::prost::alloc::string::String, #[prost(string, optional, tag = "10")] pub rate_date: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, optional, tag = "11")] pub units_per_eur: ::core::option::Option<::prost::alloc::string::String>, #[prost(int64, optional, tag = "12")] pub rate_observation_id: ::core::option::Option, #[prost(string, optional, tag = "13")] pub observation_hash: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, optional, tag = "14")] pub source_payload_hash: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, optional, tag = "15")] pub rate_fetched_at: ::core::option::Option<::prost::alloc::string::String>, #[prost(int64, optional, tag = "16")] pub import_batch_id: ::core::option::Option, #[prost(string, optional, tag = "17")] pub source_endpoint: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, tag = "18")] pub evidence_created_at: ::prost::alloc::string::String, /// Present only when determination_method is custom_rate. The hand-entered row /// that supplied rate_date and units_per_eur. The row itself stays editable, so /// the figures above are the immutable record of what was actually applied. #[prost(int64, optional, tag = "19")] pub custom_rate_table_definition_id: ::core::option::Option, #[prost(int64, optional, tag = "20")] pub custom_rate_record_id: ::core::option::Option, #[prost(int64, optional, tag = "21")] pub custom_rate_row_revision: ::core::option::Option, #[prost(string, optional, tag = "22")] pub custom_rate_note: ::core::option::Option<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListEcbConversionEvidenceResponse { /// True when at least one evidence row for this cell used a rate, whether it /// came from ECB or from a hand-entered custom row. #[prost(bool, tag = "1")] pub has_exchange: bool, /// Newest-first immutable history for this page. #[prost(message, repeated, tag = "2")] pub evidence: ::prost::alloc::vec::Vec, /// True when another page exists using the last evidence_id as the cursor. #[prost(bool, tag = "3")] pub has_more: bool, } /// Accounting date rule used to select an ECB publication. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum EcbConversionContext { Unspecified = 0, OrdinaryTransaction = 1, FinancialStatement = 2, DecisiveDate = 3, } impl EcbConversionContext { /// 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 => "ECB_CONVERSION_CONTEXT_UNSPECIFIED", Self::OrdinaryTransaction => "ECB_CONVERSION_CONTEXT_ORDINARY_TRANSACTION", Self::FinancialStatement => "ECB_CONVERSION_CONTEXT_FINANCIAL_STATEMENT", Self::DecisiveDate => "ECB_CONVERSION_CONTEXT_DECISIVE_DATE", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "ECB_CONVERSION_CONTEXT_UNSPECIFIED" => Some(Self::Unspecified), "ECB_CONVERSION_CONTEXT_ORDINARY_TRANSACTION" => { Some(Self::OrdinaryTransaction) } "ECB_CONVERSION_CONTEXT_FINANCIAL_STATEMENT" => { Some(Self::FinancialStatement) } "ECB_CONVERSION_CONTEXT_DECISIVE_DATE" => Some(Self::DecisiveDate), _ => None, } } } /// Generated client implementations. pub mod ecb_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; /// Read-only access to ECB conversion previews and audit evidence. /// /// This service exists for manual visual verification before and after posting. /// Preview performs the authoritative unrounded backend calculation without /// writing; evidence exposes conversions already recorded by posting workflows. #[derive(Debug, Clone)] pub struct EcbServiceClient { inner: tonic::client::Grpc, } impl EcbServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl EcbServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> EcbServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { EcbServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } /// Preview the exact conversion the backend would currently perform. /// This reads local verified ECB data and never persists conversion evidence. pub async fn preview_ecb_conversion( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.ecb.EcbService/PreviewEcbConversion", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new("komp_ac.ecb.EcbService", "PreviewEcbConversion"), ); self.inner.unary(req, path, codec).await } /// List immutable ECB conversion evidence for one money value. pub async fn list_ecb_conversion_evidence( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.ecb.EcbService/ListEcbConversionEvidence", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.ecb.EcbService", "ListEcbConversionEvidence", ), ); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod ecb_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with EcbServiceServer. #[async_trait] pub trait EcbService: std::marker::Send + std::marker::Sync + 'static { /// Preview the exact conversion the backend would currently perform. /// This reads local verified ECB data and never persists conversion evidence. async fn preview_ecb_conversion( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// List immutable ECB conversion evidence for one money value. async fn list_ecb_conversion_evidence( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } /// Read-only access to ECB conversion previews and audit evidence. /// /// This service exists for manual visual verification before and after posting. /// Preview performs the authoritative unrounded backend calculation without /// writing; evidence exposes conversions already recorded by posting workflows. #[derive(Debug)] pub struct EcbServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl EcbServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for EcbServiceServer where T: EcbService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/komp_ac.ecb.EcbService/PreviewEcbConversion" => { #[allow(non_camel_case_types)] struct PreviewEcbConversionSvc(pub Arc); impl< T: EcbService, > tonic::server::UnaryService for PreviewEcbConversionSvc { type Response = super::PreviewEcbConversionResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::preview_ecb_conversion(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = PreviewEcbConversionSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.ecb.EcbService/ListEcbConversionEvidence" => { #[allow(non_camel_case_types)] struct ListEcbConversionEvidenceSvc(pub Arc); impl< T: EcbService, > tonic::server::UnaryService< super::ListEcbConversionEvidenceRequest, > for ListEcbConversionEvidenceSvc { type Response = super::ListEcbConversionEvidenceResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< super::ListEcbConversionEvidenceRequest, >, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_ecb_conversion_evidence( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListEcbConversionEvidenceSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new( tonic::body::Body::default(), ); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for EcbServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "komp_ac.ecb.EcbService"; impl tonic::server::NamedService for EcbServiceServer { const NAME: &'static str = SERVICE_NAME; } }