/* * Copyright (C) 2022 Ortega Froysa, Nicolás * Author: Ortega Froysa, Nicolás * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ use uuid::Uuid; pub struct Habit { uid:Uuid, name:String, bad:bool, weight:u8, } impl Habit { pub fn new(name:String, bad:bool, weight:u8) -> Self { Self { uid: Uuid::new_v4(), name, bad, weight, } } pub fn get_uid(&self) -> String { self.uid.to_string() } pub fn get_name(&self) -> &String { &self.name } pub fn get_bad(&self) -> bool { self.bad } pub fn get_weight(&self) -> u8 { self.weight } pub fn set_name(&mut self, name:String) { self.name = name; } pub fn set_bad(&mut self, bad:bool) { self.bad = bad; } pub fn set_weight(&mut self, weight:u8) { self.weight = weight; } }