use crate::authentication::IdentityProvider;
use async_trait::async_trait;
use oauth2_signin::web_app::SigninFlowHandleCallbackRet;
use pbbson::Model;
use tonic::metadata::MetadataMap;

#[derive(Clone, Debug)]
pub struct AuthenticationResponse {
    pub idp: IdentityProvider,
    pub account: Model,
    pub linked_account: Model,
    pub account_created: bool,
    pub linked_account_created: bool,
}

#[async_trait]
#[allow(unused)]
pub trait Authenticator {
    async fn authenticate(
        &self,
        idp: IdentityProvider,
        req_metadata: &MetadataMap,
        callback_res: SigninFlowHandleCallbackRet,
    ) -> Result<AuthenticationResponse, Box<dyn std::error::Error>>;
}
