// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Identity
{
///
/// Provides an abstraction for a storage and management of roles.
///
/// The type that represents a role.
public interface IRoleStore : IDisposable where TRole : class
{
///
/// Creates a new role in a store as an asynchronous operation.
///
/// The role to create in the store.
/// The used to propagate notifications that the operation should be canceled.
/// A that represents the of the asynchronous query.
Task CreateAsync(TRole role, CancellationToken cancellationToken);
///
/// Updates a role in a store as an asynchronous operation.
///
/// The role to update in the store.
/// The used to propagate notifications that the operation should be canceled.
/// A that represents the of the asynchronous query.
Task UpdateAsync(TRole role, CancellationToken cancellationToken);
///
/// Deletes a role from the store as an asynchronous operation.
///
/// The role to delete from the store.
/// The used to propagate notifications that the operation should be canceled.
/// A that represents the of the asynchronous query.
Task DeleteAsync(TRole role, CancellationToken cancellationToken);
///
/// Gets the ID for a role from the store as an asynchronous operation.
///
/// The role whose ID should be returned.
/// The used to propagate notifications that the operation should be canceled.
/// A that contains the ID of the role.
Task GetRoleIdAsync(TRole role, CancellationToken cancellationToken);
///
/// Gets the name of a role from the store as an asynchronous operation.
///
/// The role whose name should be returned.
/// The used to propagate notifications that the operation should be canceled.
/// A that contains the name of the role.
Task GetRoleNameAsync(TRole role, CancellationToken cancellationToken);
///
/// Sets the name of a role in the store as an asynchronous operation.
///
/// The role whose name should be set.
/// The name of the role.
/// The used to propagate notifications that the operation should be canceled.
/// The that represents the asynchronous operation.
Task SetRoleNameAsync(TRole role, string roleName, CancellationToken cancellationToken);
///
/// Get a role's normalized name as an asynchronous operation.
///
/// The role whose normalized name should be retrieved.
/// The used to propagate notifications that the operation should be canceled.
/// A that contains the name of the role.
Task GetNormalizedRoleNameAsync(TRole role, CancellationToken cancellationToken);
///
/// Set a role's normalized name as an asynchronous operation.
///
/// The role whose normalized name should be set.
/// The normalized name to set
/// The used to propagate notifications that the operation should be canceled.
/// The that represents the asynchronous operation.
Task SetNormalizedRoleNameAsync(TRole role, string normalizedName, CancellationToken cancellationToken);
///
/// Finds the role who has the specified ID as an asynchronous operation.
///
/// The role ID to look for.
/// The used to propagate notifications that the operation should be canceled.
/// A that result of the look up.
Task FindByIdAsync(string roleId, CancellationToken cancellationToken);
///
/// Finds the role who has the specified normalized name as an asynchronous operation.
///
/// The normalized role name to look for.
/// The used to propagate notifications that the operation should be canceled.
/// A that result of the look up.
Task FindByNameAsync(string normalizedRoleName, CancellationToken cancellationToken);
}
}