use crate::Result;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
pub trait SwiftField: Serialize + for<'de> Deserialize<'de> + Clone + std::fmt::Debug {
fn parse(value: &str) -> Result<Self>
where
Self: Sized;
fn parse_with_variant(
value: &str,
_variant: Option<&str>,
_field_tag: Option<&str>,
) -> Result<Self>
where
Self: Sized,
{
Self::parse(value)
}
fn to_swift_string(&self) -> String;
fn get_variant_tag(&self) -> Option<&'static str> {
None
}
}
pub trait SwiftMessageBody: Debug + Clone + Send + Sync + Serialize + std::any::Any {
fn message_type() -> &'static str;
fn parse_from_block4(_block4: &str) -> Result<Self>
where
Self: Sized,
{
panic!("parse_from_block4 not implemented for message type")
}
fn to_mt_string(&self) -> String;
fn validate_network_rules(
&self,
_stop_on_first_error: bool,
) -> Vec<crate::errors::SwiftValidationError> {
Vec::new()
}
}