diff --git a/src/lib.rs b/src/lib.rs index 1bfcbf2..4915c8a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,7 @@ mod stdtype; mod subjects; mod substitutions; mod themes; +mod timetable; mod user; mod webmodules; mod what_if; @@ -33,6 +34,10 @@ pub use stdtype::StdType; pub use subjects::{Subject, Subjects}; pub use substitutions::{SubstitutionChange, Substitutions}; pub use themes::{Theme, Themes}; +pub use timetable::{ + Timetable, TimetableAtom, TimetableChange, TimetableClass, TimetableDay, TimetableGroup, + TimetableHour, +}; pub use user::{Module, User}; pub use webmodules::{Webmodule, Webmodules}; pub use what_if::{WhatIfResult, WhatIfResultMark, WhatIfStartingEnviromentMark}; diff --git a/src/timetable.rs b/src/timetable.rs new file mode 100644 index 0000000..8b7b6ed --- /dev/null +++ b/src/timetable.rs @@ -0,0 +1,80 @@ +use chrono::{DateTime, Utc}; +use serde::{Deserialize, Serialize}; + +use crate::StdType; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Timetable { + pub hours: Vec, + pub days: Vec, + pub classes: Vec, + pub groups: Vec, + pub subjects: Vec, + pub teachers: Vec, + pub rooms: Vec, + pub cycles: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct TimetableHour { + pub id: u8, + pub caption: String, + pub begin_time: String, + pub end_time: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct TimetableDay { + pub atoms: Vec, + pub day_of_week: u8, + pub date: DateTime, + pub day_description: String, + pub day_type: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct TimetableAtom { + pub hour_id: u8, + pub group_ids: Vec, + pub subject_id: Option, + pub teacher_id: Option, + pub room_id: Option, + pub cycle_ids: Vec, + pub change: Option, + pub homework_ids: Vec, + pub theme: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct TimetableChange { + pub change_subject: Option, + pub day: DateTime, + pub hours: String, + pub change_type: String, + pub description: String, + pub time: String, + pub type_abbrev: Option, + pub type_name: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct TimetableClass { + pub id: String, + pub abbrev: String, + pub name: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct TimetableGroup { + pub class_id: String, + pub id: String, + pub abbrev: String, + pub name: String, +} diff --git a/tracker.md b/tracker.md index edd0011..be51ea4 100644 --- a/tracker.md +++ b/tracker.md @@ -14,7 +14,7 @@ - [x] subjects - [x] substitutions - [x] themes -- [ ] timetable +- [x] timetable - [x] user - [x] user SettingModules - [x] web