use std::sync::Arc;

use crate::templates::TemplateEngine;
use forage_core::auth::ForestAuth;
use forage_core::platform::ForestPlatform;
use forage_core::session::SessionStore;

#[derive(Clone)]
pub struct AppState {
    pub templates: TemplateEngine,
    pub forest_client: Arc<dyn ForestAuth>,
    pub platform_client: Arc<dyn ForestPlatform>,
    pub sessions: Arc<dyn SessionStore>,
}

impl AppState {
    pub fn new(
        templates: TemplateEngine,
        forest_client: Arc<dyn ForestAuth>,
        platform_client: Arc<dyn ForestPlatform>,
        sessions: Arc<dyn SessionStore>,
    ) -> Self {
        Self {
            templates,
            forest_client,
            platform_client,
            sessions,
        }
    }
}
