angular.module('camotionAdmin')
    .controller('HostsController', ['$scope', 'HostsService',
        function($scope, HostsService) {

            $scope.luTable = {
                columns: [
                    {
                        name: "Name",
                        width: 4,
                        getValue: function (item) {
                            return item.Name;
                        }
                    }, {
                        name: "URL",
                        width: 8,
                        getValue: function (item) {
                            return item.Url;
                        }
                    }
                ],

                canAdd: 'CAMOTION_HOST_ADD',

                canDel: 'CAMOTION_HOST_DEL',

                canEdit: function()
                {
                    return true;
                },

                getLoadPagePromise: function (page, perPage, query, promise) {
                    return HostsService.getAll({page: page, perPage: perPage, query: query}, promise);
                },

                getDelPromise: function (id, promise) {
                    return HostsService.del({host_id: id}, promise);
                },

                getEditController: function () {
                    return "HostEdit";
                }
            };
    }]);