use crate::social::core::{IdToken, SocialAuthError, StandardClaims, TokenResponse};
use async_trait::async_trait;
#[async_trait]
pub trait OAuthProvider: Send + Sync {
fn name(&self) -> &str;
fn is_oidc(&self) -> bool;
async fn authorization_url(
&self,
state: &str,
nonce: Option<&str>,
code_challenge: Option<&str>,
) -> Result<String, SocialAuthError>;
async fn exchange_code(
&self,
code: &str,
code_verifier: Option<&str>,
) -> Result<TokenResponse, SocialAuthError>;
async fn refresh_token(&self, refresh_token: &str) -> Result<TokenResponse, SocialAuthError>;
async fn validate_id_token(
&self,
_id_token: &str,
_nonce: Option<&str>,
) -> Result<IdToken, SocialAuthError> {
Err(SocialAuthError::NotSupported(
"OIDC not supported by this provider".into(),
))
}
async fn get_user_info(&self, access_token: &str) -> Result<StandardClaims, SocialAuthError>;
async fn revoke_token(&self, _token: &str) -> Result<(), SocialAuthError> {
Ok(())
}
}