1use crate::XSorts;
2use alux_sdk::case_mapping;
3
4pub trait XAttachmentAlg: XSorts {
6 fn attachment(
8 &self,
9 identity: impl Into<String>,
10 kind: AttachmentKind,
11 address: impl Into<String>,
12 ) -> Self::Attachment;
13}
14
15pub trait XAttachmentViewAlg: XSorts {
17 fn attachment_identity<'a>(&self, attachment: &'a Self::Attachment) -> &'a str;
19 fn attachment_kind(&self, attachment: &Self::Attachment) -> AttachmentKind;
21 fn attachment_address<'a>(&self, attachment: &'a Self::Attachment) -> &'a str;
23}
24
25#[derive(Clone, Copy, Debug, PartialEq, Eq)]
27pub enum AttachmentKind {
28 Photo,
30 Video,
32 Animation,
34}
35
36case_mapping! {
37 AttachmentKind, &'static str as &str,
38 Photo <=> "photo",
39 Video <=> "video",
40 Animation <=> "animated_gif",
41}