use crate::errors::DomainError; use super::ContentType; #[derive(Debug, Clone)] pub struct MediaUpload { data: Vec, content_type: ContentType, } impl MediaUpload { pub fn new(data: Vec, content_type: ContentType) -> Result { if data.is_empty() { return Err(DomainError::InvalidInput( "media data cannot be empty".into(), )); } Ok(Self { data, content_type }) } pub fn data(&self) -> &[u8] { &self.data } pub fn content_type(&self) -> &ContentType { &self.content_type } pub fn size(&self) -> usize { self.data.len() } }