use nautilus_common::command::set_pwm::SetPwm;
use nautilus_common::command::valid_priority_command::ValidPriorityCommand;
use std::time::Instant;

pub mod task;

pub trait Drive {
    fn set_throttle(&self, throttle: f64, valid_until: Instant, priority: u8);


    fn new_set_throttle_callback<'a>(&self) -> impl Fn(ValidPriorityCommand<SetPwm>) + 'a
    where
        Self: Sized + Clone + 'a,
    {
        let this = self.clone();
        move |cmd| {
            this.set_throttle(
                cmd.throttle,
                cmd.get_valid_until_instant(),
                cmd.priority,
            );
        }
    }
}
