using Lactose.Models;

namespace Lactose.Repositories;

public interface IUserRepository : IDisposable {
    /// <summary>
    /// Return the list of all users
    /// </summary>
    /// <returns></returns>
    IEnumerable<User> GetAll();

    /// <summary>
    /// Insert a new uer
    /// </summary>
    /// <param name="user"></param>
    void Insert(User user);

    /// <summary>
    /// Saves all the changes to the Model
    /// </summary>
    void Save();

    /// <summary>
    /// Get the user from the database. 
    /// </summary>
    /// <param name="id"></param>
    /// <returns>Returns the user if exist</returns>
    User? Find(Guid id);

    /// <summary>
    /// Find a user by email, expects that the email is unique
    /// </summary>
    /// <param name="email"></param>
    /// <returns>Returns the user if found </returns>
    User? FindByEmail(string email);

    /// <summary>
    /// Find a user by username, expects that the username is unique
    /// </summary>
    /// <param name="username"></param>
    /// <returns>Returns the user if found </returns>
    User? FindByUsername(string username);

    /// <summary>
    /// Delete a user from the database.
    /// </summary>
    /// <param name="user"></param>
    void Delete(User user);
}
