using Lactose.Models;

namespace Lactose.Repositories;

public interface ITagRepository : IDisposable {
    /// <summary>
    /// Search for tags that are like the given <paramref name="searchQuery"/>
    /// </summary>
    /// <param name="searchQuery">the search query</param>
    /// <param name="page"> the number of the page for the given query</param>
    /// <param name="pageSize">the size of the page</param>
    /// <returns>list of tags of type <see cref="Tag"/> with the size <paramref name="pageSize"/></returns>
    List<Tag> Search(string searchQuery, int page, int pageSize);

    /// <summary>
    /// Returns all the tags
    /// </summary>
    /// <returns></returns>
    IEnumerable<Tag> GetAll();

    /// <summary>
    /// Find a specific Tag given the id
    /// </summary>
    /// <param name="id">identifier of the tag</param>
    /// <returns>the <see cref="Tag"/> or null</returns>
    Tag? Find(Guid id);
    
    /// <summary>
    /// Find a specific Tag given the name
    /// </summary>
    /// <param name="name">the exact name of the tag</param>
    /// <returns></returns>
    Tag? FindByName(string name);


    /// <summary>
    /// Return the list of the children of the given tag
    /// </summary>
    /// <param name="id">identifier of the tag</param>
    /// <returns>the list of <see cref="Tag"/>, could be empty</returns>
    List<Tag> GetChildren(Guid id);

    void Save();

    /// <summary>
    /// Deletes a tag by the given <paramref name="id"/>
    /// </summary>
    /// <param name="id"></param>
    void Delete(Tag id);

    /// <summary>
    /// Insert a new Tag
    /// </summary>
    /// <param name="tag"></param>
    void Insert(Tag tag);
}
