
Some checks are pending
iOS UniFFI Build / build-ios (push) Waiting to run
Add church management API library with cross-platform support for iOS, Android, and WASM. Features include event management, bulletin handling, contact forms, and authentication.
136 lines
3.6 KiB
Rust
136 lines
3.6 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct BibleVerse {
|
|
pub text: String,
|
|
pub reference: String,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub version: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub book: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub chapter: Option<u32>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub verse: Option<u32>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub category: Option<VerseCategory>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct VerseOfTheDay {
|
|
pub verse: BibleVerse,
|
|
pub date: chrono::NaiveDate,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub commentary: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub theme: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
|
pub enum VerseCategory {
|
|
#[serde(rename = "comfort")]
|
|
Comfort,
|
|
#[serde(rename = "hope")]
|
|
Hope,
|
|
#[serde(rename = "faith")]
|
|
Faith,
|
|
#[serde(rename = "love")]
|
|
Love,
|
|
#[serde(rename = "peace")]
|
|
Peace,
|
|
#[serde(rename = "strength")]
|
|
Strength,
|
|
#[serde(rename = "wisdom")]
|
|
Wisdom,
|
|
#[serde(rename = "guidance")]
|
|
Guidance,
|
|
#[serde(rename = "forgiveness")]
|
|
Forgiveness,
|
|
#[serde(rename = "salvation")]
|
|
Salvation,
|
|
#[serde(rename = "prayer")]
|
|
Prayer,
|
|
#[serde(rename = "praise")]
|
|
Praise,
|
|
#[serde(rename = "thanksgiving")]
|
|
Thanksgiving,
|
|
#[serde(rename = "other")]
|
|
Other,
|
|
}
|
|
|
|
impl BibleVerse {
|
|
pub fn new(text: String, reference: String) -> Self {
|
|
Self {
|
|
text,
|
|
reference,
|
|
version: None,
|
|
book: None,
|
|
chapter: None,
|
|
verse: None,
|
|
category: None,
|
|
}
|
|
}
|
|
|
|
pub fn with_version(mut self, version: String) -> Self {
|
|
self.version = Some(version);
|
|
self
|
|
}
|
|
|
|
pub fn with_book(mut self, book: String) -> Self {
|
|
self.book = Some(book);
|
|
self
|
|
}
|
|
|
|
pub fn with_location(mut self, chapter: u32, verse: u32) -> Self {
|
|
self.chapter = Some(chapter);
|
|
self.verse = Some(verse);
|
|
self
|
|
}
|
|
|
|
pub fn with_category(mut self, category: VerseCategory) -> Self {
|
|
self.category = Some(category);
|
|
self
|
|
}
|
|
}
|
|
|
|
impl VerseOfTheDay {
|
|
pub fn new(verse: BibleVerse, date: chrono::NaiveDate) -> Self {
|
|
Self {
|
|
verse,
|
|
date,
|
|
commentary: None,
|
|
theme: None,
|
|
}
|
|
}
|
|
|
|
pub fn with_commentary(mut self, commentary: String) -> Self {
|
|
self.commentary = Some(commentary);
|
|
self
|
|
}
|
|
|
|
pub fn with_theme(mut self, theme: String) -> Self {
|
|
self.theme = Some(theme);
|
|
self
|
|
}
|
|
}
|
|
|
|
impl VerseCategory {
|
|
pub fn display_name(&self) -> &'static str {
|
|
match self {
|
|
VerseCategory::Comfort => "Comfort",
|
|
VerseCategory::Hope => "Hope",
|
|
VerseCategory::Faith => "Faith",
|
|
VerseCategory::Love => "Love",
|
|
VerseCategory::Peace => "Peace",
|
|
VerseCategory::Strength => "Strength",
|
|
VerseCategory::Wisdom => "Wisdom",
|
|
VerseCategory::Guidance => "Guidance",
|
|
VerseCategory::Forgiveness => "Forgiveness",
|
|
VerseCategory::Salvation => "Salvation",
|
|
VerseCategory::Prayer => "Prayer",
|
|
VerseCategory::Praise => "Praise",
|
|
VerseCategory::Thanksgiving => "Thanksgiving",
|
|
VerseCategory::Other => "Other",
|
|
}
|
|
}
|
|
} |