package com.insa.app.database;

import com.insa.app.model.User;
import com.insa.app.network.NetworkMessage;

import java.util.List;
import java.util.Map;

public interface DatabaseInterface {

    /** This method should store the main user of the application **/
    public void storeMe(User user);

    /** This method should store the given NetworkMessage using the emitter UUID as a key **/
    void storeMessage(NetworkMessage mess);

    /** This method should store the given User using the user UUID as a key **/
    public void storeUser(User user);

    /**  This method returns the list of messages associated with an emitter UUID key.
     *   If the given key match the user key it should return an empty list.
     **/
    List<NetworkMessage> getMessages(User user);

    /** This method should return all the conversations stored in the database **/
    Map<User,List<NetworkMessage>> getAllConversations();

    /** This method should either :
     * - Initialize the UUID and store it
     * - Retrieve the UUID from the database
     **/
    User getMe();

    /** This method should store the new username for the current user **/
    void setUserName(String newName);

    void closeDatabase();

}
