rodo_lib 0.1.2

A Library for a Todo Manager
Documentation
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use uuid::Uuid;

use crate::utils::RodoStruct;

// NOTE: actually implement this!!!

pub enum FIELDS {
    TODO(uuid::Uuid),
    WHEN(u64),
    TILL(u64),
}

#[serde_as]
#[derive(Serialize, Deserialize, Clone, Debug)]
/// Struct representing a recurring Todo
///
/// * `todo`: the Uuid of the Todo
/// * `when`: after which time the Todo should be recreated/copied
/// * `till`: after which time the recurring Todo should be automaticly deactivated
/// * `active`: if the recurring Todo is "running"
pub struct Recurring {
    todo: Uuid,
    when: u64,
    till: u64,
    active: bool,
}

impl Recurring {
    pub fn new(todo: Uuid, when: u64, till: u64, active: bool) -> (Uuid, Self) {
        (
            Uuid::new_v4(),
            Self {
                todo,
                when,
                till,
                active,
            },
        )
    }

    pub fn toogle_active(&mut self) {
        todo!();
    }
}

impl RodoStruct<FIELDS> for Recurring {
    fn edit(&mut self, fields: FIELDS) {
        match fields {
            // FIX: think of a way to handle this
            FIELDS::TODO(_) => todo!(),
            FIELDS::WHEN(_) => todo!(),
            FIELDS::TILL(_) => todo!(),
        }
    }
}