/**
 * Created by robin on 11/21/15.
 */
(function () {
    'use strict';

    angular.module('camotionSdk')
        .factory('CamerasService', ['luticateRequest', function (luticateRequest) {

            var CamerasService = {};

            CamerasService.add = function(data, promise)
            {
                return luticateRequest.post("/api/cameras/add", {camera: JSON.stringify(data)}, null, promise);
            };

            CamerasService.getAll = function(data, promise)
            {
                return luticateRequest.get("/api/cameras", data, promise);
            };

            CamerasService.getAllTypes = function(promise)
            {
                return luticateRequest.get("/api/cameras/types", null, promise);
            };

            CamerasService.get = function(data, promise)
            {
                return luticateRequest.get("/api/cameras/" + data.camera_id , null, promise);
            };

            CamerasService.edit = function(data, promise)
            {
                return luticateRequest.post("/api/cameras/" + data.camera_id + "/edit", {camera: JSON.stringify(data)}, null, promise);
            };

            CamerasService.del = function(data, promise)
            {
                return luticateRequest.post("/api/cameras/" + data.camera_id + "/del", null, null, promise);
            };

            CamerasService.getImage = function(data, promise)
            {
                return luticateRequest.post("/api/cameras/" + data.camera_id + "/image", null, null, promise);
            };

            return CamerasService;
        }]);
})();