using Butter.Dtos;
using Butter.Dtos.Person;
using Butter.Types;
using Lactose.Models;
///
/// Interface for person repository operations.
///
public interface IPersonRepository : IDisposable {
///
/// Inserts a new person into the database.
///
/// The person to insert.
void Insert(Person person);
///
/// Saves all pending changes to the database.
///
void Save();
///
/// Finds a person by their ID.
///
/// The ID of the person.
/// The person if found; otherwise, null.
Person? Find(Guid id);
///
/// Finds a person by their ID with albums and assets filtered by the requesting user's access level.
///
/// The ID of the person.
/// The requesting user's ID for visibility-scoped filtering.
/// The requesting user's access level.
/// Optional search term to filter albums by title.
/// Optional field to sort albums by ("name", "created", "updated", "assets").
/// Whether to sort albums ascending.
/// Zero-based page number for album pagination.
/// Number of albums per page (default 150, max 250).
/// The person if found; otherwise, null.
Person? FindVisible(Guid id, Guid? userId = null, EAccessLevel accessLevel = EAccessLevel.User,
string? albumSearch = null, string? albumSortBy = null, bool albumSortAsc = true,
int albumPage = 0, int albumPageSize = PagedParametersDto.MaxPageSize);
///
/// Finds a person by their name (case-sensitive).
///
/// The name of the person.
/// The person if found; otherwise, null.
Person? FindByName(string name);
///
/// Finds all people whose names are in the given set.
///
/// The names to search for.
/// A collection of people with matching names (non-deleted only).
IEnumerable FindByNames(IEnumerable names);
///
/// Retrieves all non-deleted people.
///
IEnumerable GetAll();
///
/// Retrieves all non-deleted people that have at least one album with visible assets for the given user.
/// For and , returns all people.
///
/// The current user's ID.
/// The current user's access level.
IEnumerable GetAllVisible(Guid userId, EAccessLevel accessLevel);
///
/// Searches for people based on a query string with optional sorting and pagination.
/// Respects access-level filtering for regular users.
///
/// The search query string to filter by name.
/// The page number for pagination (default is 0).
/// The number of results per page (default is 30).
/// The field to sort by (e.g. "name", "created", "albums"). When null, defaults to name ascending.
/// Whether to sort ascending. Default is true.
/// The current user's ID for access-level filtering.
/// The current user's access level.
/// A paginated list of person previews matching the query.
IEnumerable SearchQuery(string query, int page = 0, int pageSize = 30, string? sortBy = null, bool sortAsc = true, Guid userId = default, EAccessLevel accessLevel = EAccessLevel.User);
///
/// Finds multiple people by their IDs.
///
/// The IDs to find.
/// A collection of matching people.
IEnumerable FindBulk(IEnumerable ids);
///
/// Merges multiple source people into a destination person.
/// Albums, faces, and maintainers are reassigned to the destination, then source people are hard-deleted.
///
/// The ID of the destination person.
/// The IDs of the source people to merge.
void MergePeople(Guid destId, List sourceIds);
///
/// Removes a person from the database.
///
/// The person to remove.
void Remove(Person person);
///
/// Checks whether a user is a maintainer of a specific person.
///
/// The user ID to check.
/// The person ID to check.
/// if the user is a maintainer of the person.
bool IsMaintainerOf(Guid userId, Guid personId);
///
/// Sets the list of user IDs that maintain this person.
/// Replaces any existing maintainer assignments.
///
/// The person ID.
/// The user IDs to assign as maintainers.
void SetMaintainers(Guid personId, IEnumerable userIds);
}