using System;
using System.Collections.Generic;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Persistence.Querying;
namespace Umbraco.Cms.Core.Services
{
///
/// Defines the MemberService, which is an easy access to operations involving (umbraco) members.
///
public interface IMemberService : IMembershipMemberService
{
///
/// Gets a list of paged objects
///
/// An can be of type
/// Current page index
/// Size of the page
/// Total number of records found (out)
/// Field to order by
/// Direction to order by
///
/// Search text filter
///
IEnumerable GetAll(long pageIndex, int pageSize, out long totalRecords,
string orderBy, Direction orderDirection, string? memberTypeAlias = null, string filter = "");
///
/// Gets a list of paged objects
///
/// An can be of type
/// Current page index
/// Size of the page
/// Total number of records found (out)
/// Field to order by
/// Direction to order by
/// Flag to indicate when ordering by system field
///
/// Search text filter
///
IEnumerable GetAll(long pageIndex, int pageSize, out long totalRecords,
string orderBy, Direction orderDirection, bool orderBySystemField, string? memberTypeAlias, string filter);
///
/// Creates an object without persisting it
///
/// This method is convenient for when you need to add properties to a new Member
/// before persisting it in order to limit the amount of times its saved.
/// Also note that the returned will not have an Id until its saved.
/// Username of the Member to create
/// Email of the Member to create
/// Name of the Member to create
/// Alias of the MemberType the Member should be based on
///
IMember CreateMember(string username, string email, string name, string memberTypeAlias);
///
/// Creates an object without persisting it
///
/// This method is convenient for when you need to add properties to a new Member
/// before persisting it in order to limit the amount of times its saved.
/// Also note that the returned will not have an Id until its saved.
/// Username of the Member to create
/// Email of the Member to create
/// Name of the Member to create
/// MemberType the Member should be based on
///
IMember CreateMember(string username, string email, string name, IMemberType memberType);
///
/// Creates and persists a Member
///
/// Using this method will persist the Member object before its returned
/// meaning that it will have an Id available (unlike the CreateMember method)
/// Username of the Member to create
/// Email of the Member to create
/// Name of the Member to create
/// Alias of the MemberType the Member should be based on
///
IMember CreateMemberWithIdentity(string username, string email, string name, string memberTypeAlias);
///
/// Creates and persists a Member
///
/// Using this method will persist the Member object before its returned
/// meaning that it will have an Id available (unlike the CreateMember method)
/// Username of the Member to create
/// Email of the Member to create
/// Name of the Member to create
/// MemberType the Member should be based on
///
IMember CreateMemberWithIdentity(string username, string email, string name, IMemberType memberType);
///
/// Gets the count of Members by an optional MemberType alias
///
/// If no alias is supplied then the count for all Member will be returned
/// Optional alias for the MemberType when counting number of Members
/// with number of Members
int Count(string? memberTypeAlias = null);
///
/// Checks if a Member with the id exists
///
/// Id of the Member
/// True if the Member exists otherwise False
bool Exists(int id);
///
/// Gets a Member by the unique key
///
/// The guid key corresponds to the unique id in the database
/// and the user id in the membership provider.
/// Id
///
IMember? GetByKey(Guid id);
///
/// Gets a Member by its integer id
///
/// Id
///
IMember? GetById(int id);
///
/// Gets all Members for the specified MemberType alias
///
/// Alias of the MemberType
///
IEnumerable GetMembersByMemberType(string memberTypeAlias);
///
/// Gets all Members for the MemberType id
///
/// Id of the MemberType
///
IEnumerable GetMembersByMemberType(int memberTypeId);
///
/// Gets all Members within the specified MemberGroup name
///
/// Name of the MemberGroup
///
IEnumerable GetMembersByGroup(string memberGroupName);
///
/// Gets all Members with the ids specified
///
/// If no Ids are specified all Members will be retrieved
/// Optional list of Member Ids
///
IEnumerable GetAllMembers(params int[] ids);
///
/// Delete Members of the specified MemberType id
///
/// Id of the MemberType
void DeleteMembersOfType(int memberTypeId);
///
/// Finds Members based on their display name
///
/// Display name to match
/// Current page index
/// Size of the page
/// Total number of records found (out)
/// The type of match to make as . Default is
///
IEnumerable FindMembersByDisplayName(string displayNameToMatch, long pageIndex, int pageSize, out long totalRecords, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith);
///
/// Gets a list of Members based on a property search
///
/// Alias of the PropertyType to search for
/// Value to match
/// The type of match to make as . Default is
///
IEnumerable? GetMembersByPropertyValue(string propertyTypeAlias, string value, StringPropertyMatchType matchType = StringPropertyMatchType.Exact);
///
/// Gets a list of Members based on a property search
///
/// Alias of the PropertyType to search for
/// Value to match
/// The type of match to make as . Default is
///
IEnumerable? GetMembersByPropertyValue(string propertyTypeAlias, int value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact);
///
/// Gets a list of Members based on a property search
///
/// Alias of the PropertyType to search for
/// Value to match
///
IEnumerable? GetMembersByPropertyValue(string propertyTypeAlias, bool value);
///
/// Gets a list of Members based on a property search
///
/// Alias of the PropertyType to search for
/// Value to match
/// The type of match to make as . Default is
///
IEnumerable? GetMembersByPropertyValue(string propertyTypeAlias, DateTime value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact);
}
}