package com.rthoni.camotion.dataaccess;

import com.luticate.utils.business.LuPromise;
import com.luticate.utils.business.LuRequest;
import com.luticate.utils.dataaccess.LuDataAccess;
import com.luticate.utils.dbo.LuDataAccessConfigDbo;
import com.rthoni.camotion.dbo.CameraDbo;
import com.rthoni.camotion.dbo.CameraImageDbo;

import java.util.HashMap;

/**
 * Created by robin on 12/3/15.
 */
public class CamerasDataAccess extends LuDataAccess {

    public static LuPromise<CameraDbo.MultipleCameraDbo> getAll(LuDataAccessConfigDbo config, int page, int perPage)
    {
        HashMap<String, String> params = new HashMap<>();
        params.put("page", "" + page);
        params.put("perPage", "" + perPage);
        return LuRequest.get(config, CameraDbo.MultipleCameraDbo.class, "/api/cameras", params);
    }

    public static LuPromise<CameraImageDbo> getImage(LuDataAccessConfigDbo config, int id)
    {
        return LuRequest.post(config, CameraImageDbo.class, "/api/cameras/" + id + "/image");
    }
}
