use crate::modules::{
    evok::models::state::EvokState,
    heat_pump::models::{config::HPConfig, state::HPState},
};

use serde::{Deserialize, Serialize};
use std::sync::{Arc, Mutex};

#[derive(Serialize, Deserialize, Debug)]
pub struct AppState {
    /// Evok current state
    pub evok_state: EvokState,
    /// Heat pump current state
    pub hp_state: HPState,
    /// Heat pump configuration
    pub hp_config: HPConfig,
}

impl AppState {
    pub fn new() -> Self {
        Self {
            evok_state: EvokState::default(),
            hp_state: HPState::default(),
            hp_config: HPConfig::default(),
        }
    }
}
impl Default for AppState {
    fn default() -> Self {
        Self::new()
    }
}

pub type SharedAppState = Arc<Mutex<AppState>>;
