using Models;
using System.Collections.Immutable;
namespace LocalServices.Data
{
///
/// The database interface defines all the different kinds of requests the LocalEndpoint needs to store and retrieve data.
///
public interface IDatabase
{
///
/// Get a Recipe from its identifier
///
///
/// The recipe if the identifier is registered in the database
public Recipe? GetRecipe(Guid id);
///
/// Get the rate of a user for a given recipe
///
/// The user identifier
/// The recipe identifier
/// Returns a rate
public RecipeRate GetRecipeRate(Guid user, Guid recipe);
///
/// Gets an account from an email and a password hash
///
///
///
/// some account if the email and the hash is found in the database
public Account? GetAccount(string email, string passwordHash);
///
/// Insert a recipe in user's weekly list
///
///
///
///
public void InsertInUserList(Guid userId, Guid recipeId, uint persAmount);
///
/// Remove a recipe from user's weekly list
///
///
///
public void RemoveFromUserList(Guid userId, Guid recipeId);
///
/// Inserts an account in the database, with the given passwordhash
///
///
///
public void InsertAccount(Account account, string passwordHash);
///
/// Inserts a recipe
///
///
public void InsertRecipe(Recipe recipe);
///
/// Inserts a user
///
///
public void InsertUser(User user);
///
/// Inserts a user rate over the given recipe identifier
///
///
///
///
public void InsertRate(Guid userId, Guid recipeId, RecipeRate rate);
///
/// Removes a recipe
///
///
public void RemoveRecipe(Guid id);
///
/// Lists all recipes in the database
///
///
public ImmutableList ListAllRecipes();
///
/// List the ratings of an user
///
///
///
public ImmutableDictionary ListRatesOf(Guid user);
///
/// Get the weekly list of given user
///
///
///
public ImmutableDictionary GetRecipeListOf(Guid user);
}
}