use std::fmt;
use serde_derive::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub enum Priority {
HIGH,
MEDIUM,
LOW,
}
impl fmt::Display for Priority {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self {
Priority::LOW => write!(f, "LOW"),
Priority::MEDIUM => write!(f, "MEDIUM"),
Priority::HIGH => write!(f, "HIGH"),
}
}
}
#[derive(Serialize, Deserialize)]
pub struct Todo {
pub title: String,
pub description: String,
pub done: bool,
pub time: Priority,
pub date: String,
}
impl Todo {
pub fn new(
title: String,
description: String,
done: bool,
time: Priority,
date: String,
) -> Self {
Self {
title,
description,
done,
time,
date,
}
}
}