1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::brain::modes::heating_mode::HeatingMode;

#[derive(Debug, PartialEq)]
pub enum Intention {
    /// Forcefully switch to the given mode without allowing any other interaction
    SwitchForce(HeatingMode),
    /// Keep the current state
    KeepState,
    /// Finish the current state
    Finish,
    /// Yield to a heat up if we are below its minimum temperature.
    YieldHeatUps,
}

impl Intention {
    /// Turn off immediately
    #[must_use]
    pub fn off_now() -> Intention {
        Intention::SwitchForce(HeatingMode::off())
    }

    /// Shows that this state has ended,
    /// and so another state must begin,
    /// if no state believes it should activate
    /// then this will turn everything off.
    #[must_use]
    pub fn finish() -> Intention {
        Intention::Finish
    }
}