use core::option::Option;
use std::time::SystemTime;
use crate::{ExternalIdentity, NythosResult, OAuthProviderKind, TenantId, UserId};
pub trait ExternalIdentityRepository {
async fn find_by_provider(
&self,
tenant_id: TenantId,
provider_kind: OAuthProviderKind,
provider_subject: &str,
) -> NythosResult<Option<ExternalIdentity>>;
async fn find_by_user(
&self,
tenant_id: TenantId,
user_id: UserId,
) -> NythosResult<Vec<ExternalIdentity>>;
async fn link(&self, identity: ExternalIdentity) -> NythosResult<()>;
async fn touch(
&self,
tenant_id: TenantId,
provider_kind: OAuthProviderKind,
provider_subject: &str,
seen_at: SystemTime,
) -> NythosResult<()>;
}