using System;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
public interface IAuthenticator
{
///
/// Type of the provider.
///
MailProviderType ProviderType { get; }
///
/// Gets the token from the cache if exists.
/// If the token is expired, tries to refresh.
/// This can throw AuthenticationAttentionException if silent refresh fails.
///
/// Account to get token for.
/// Valid token info to be used in integrators.
Task GetTokenAsync(MailAccount account);
///
/// Initial creation of token. Requires user interaction.
/// This will save token into database, but still returns for account creation
/// since account address is required.
///
/// Token cache might ask for regeneration of token for specific
/// account address. If one is provided and re-generation native token doesn't belong to this address
/// token saving to database won't happen.
/// Freshly created TokenInformation..
Task GenerateTokenAsync(MailAccount account, bool saveToken);
///
/// Required for external authorization on launched browser to continue.
/// Used for Gmail.
///
/// Response's redirect uri.
void ContinueAuthorization(Uri authorizationResponseUri);
///
/// For external browser required authentications.
/// Canceling Gmail authentication dialog etc.
///
void CancelAuthorization();
///
/// ClientId in case of needed for authorization/authentication.
///
string ClientId { get; }
}
}