package com.luticate.auth.dataaccess;

import com.luticate.auth.dbo.LuLoginDbo;
import com.luticate.utils.dataaccess.LuDataAccess;
import com.luticate.utils.business.LuPromise;
import com.luticate.utils.business.LuRequest;
import com.luticate.utils.dbo.LuDataAccessConfigDbo;

import java.util.HashMap;

/**
 *
 * Created by robin on 11/27/15.
 */
public class LuticateUsersDataAccess extends LuDataAccess {

    public static LuPromise<LuLoginDbo> login(LuDataAccessConfigDbo config, String username, String password)
    {
        HashMap<String, String> array = new HashMap<>();
        array.put("username", username);
        array.put("password", password);
        return LuRequest.post(config, LuLoginDbo.class, "/api/luticate/users/login", array);
    }

    public static LuPromise<LuLoginDbo> logout(LuDataAccessConfigDbo config)
    {
        return LuRequest.post(config, LuLoginDbo.class, "/api/luticate/users/logout");
    }
}
