osdm_sys/models/
document_format.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
17#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
18pub enum DocumentFormat {
19 #[serde(rename = "application/pdf")]
20 ApplicationSlashPdf,
21 #[serde(rename = "application/vnd.apple.pkpass")]
22 ApplicationSlashVndApplePkpass,
23 #[serde(rename = "image/jpeg")]
24 ImageSlashJpeg,
25 #[serde(rename = "image/png")]
26 ImageSlashPng,
27 #[serde(rename = "text/calendar")]
28 TextSlashCalendar,
29 #[serde(rename = "text/html")]
30 TextSlashHtml,
31
32}
33
34impl std::fmt::Display for DocumentFormat {
35 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
36 match self {
37 Self::ApplicationSlashPdf => write!(f, "application/pdf"),
38 Self::ApplicationSlashVndApplePkpass => write!(f, "application/vnd.apple.pkpass"),
39 Self::ImageSlashJpeg => write!(f, "image/jpeg"),
40 Self::ImageSlashPng => write!(f, "image/png"),
41 Self::TextSlashCalendar => write!(f, "text/calendar"),
42 Self::TextSlashHtml => write!(f, "text/html"),
43 }
44 }
45}
46
47impl Default for DocumentFormat {
48 fn default() -> DocumentFormat {
49 Self::ApplicationSlashPdf
50 }
51}
52