using Lactose.Models;

namespace Lactose.Repositories;

public interface IAlbumRepository : IDisposable {
    /// <summary>
    /// Inserts a new album into the database
    /// </summary>
    /// <param name="album"></param>
    public void Insert(Album album);

    /// <summary>
    /// Updates an album in the database
    /// </summary>
    /// <param name="album"></param>
    public void Update(Album album);

    /// <summary>
    /// Updates multiple albums in the database.
    /// </summary>
    /// <param name="albums">The albums to update.</param>
    public void UpdateBulk(IEnumerable<Album> albums);

    /// <summary>
    /// Saves changes to the database.
    /// </summary>
    public void Save();

    /// <summary>
    /// Finds an album by its ID.
    /// </summary>
    /// <param name="id">The ID of the album.</param>
    /// <returns>The album if found; otherwise, null.</returns>
    public Album? Find(Guid id);

    /// <summary>
    /// Finds albums by the owner's ID.
    /// </summary>
    /// <param name="ownerId">The ID of the owner.</param>
    /// <returns>A collection of albums owned by the specified owner.</returns>
    public IEnumerable<Album> FindByOwner(Guid ownerId);

    /// <summary>
    /// Finds albums by the person's ID.
    /// </summary>
    /// <param name="personId">The ID of the person.</param>
    /// <returns>A collection of albums associated with the specified person.</returns>
    public IEnumerable<Album> FindByPerson(Guid personId);

    /// <summary>
    /// Finds multiple albums by their IDs.
    /// </summary>
    /// <param name="ids">The IDs of the albums.</param>
    /// <returns>A collection of albums with the specified IDs.</returns>
    public IEnumerable<Album> FindBulk(IEnumerable<Guid> ids);

    /// <summary>
    /// Finds albums within a specified date range.
    /// </summary>
    /// <param name="from">The start date of the range.</param>
    /// <param name="to">The end date of the range.</param>
    /// <returns>A collection of albums created or updated within the specified date range.</returns>
    public IEnumerable<Album> FindByDateRange(DateTime from, DateTime to);

    /// <summary>
    /// Removes an album from the database.
    /// </summary>
    /// <param name="album">The album to remove.</param>
    public void Remove(Album album);

    /// <summary>
    /// Searches for albums based on a query string.
    /// </summary>
    /// <param name="query">The search query string.</param>
    /// <param name="page">The page number for pagination (default is 0).</param>
    /// <param name="pageSize">The number of results per page (default is 150).</param>
    /// <returns>A list of album IDs that match the search query.</returns>
    public IEnumerable<Album> SearchQuery(string query, int page = 0, int pageSize = 150);
}
