use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReportMetadata {
pub project_name: String,
pub project_number: String,
pub prepared_by: String,
pub checked_by: Option<String>,
pub date: String,
pub paper: PaperSize,
#[serde(default)]
pub orientation: Orientation,
}
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize)]
pub enum PaperSize {
#[default]
Letter,
Tabloid,
A4,
ArchA,
ArchB,
ArchC,
ArchD,
ArchE,
ArchE1,
}
impl PaperSize {
pub(crate) fn typst_name(self) -> &'static str {
match self {
Self::Letter => "us-letter",
Self::Tabloid => "us-tabloid",
Self::A4 => "a4",
Self::ArchA => "arch-a",
Self::ArchB => "arch-b",
Self::ArchC => "arch-c",
Self::ArchD => "arch-d",
Self::ArchE => "arch-e",
Self::ArchE1 => "arch-e1",
}
}
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
pub enum Orientation {
#[default]
Portrait,
Landscape,
}
impl Orientation {
pub(crate) fn flipped(self) -> bool {
matches!(self, Self::Landscape)
}
}