use axum::extract::FromRef;
use deadpool_diesel::postgres::Pool;
use oauth2::basic::BasicClient;

use crate::{sessions::PgStore, settings::Settings};

#[derive(Clone)]
pub(crate) struct AppState {
    pub db_pool: Pool,
    pub oauth_client: BasicClient,
    pub session_store: PgStore,
    pub settings: Settings,
}

impl FromRef<AppState> for PgStore {
    fn from_ref(state: &AppState) -> Self {
        state.session_store.clone()
    }
}
