text: (function(window, angular, undefined) {'use strict';
  
      var urlBase = "http://shared.canobus.com:8088/api";
  
      //var urlBase = "http://10.0.1.36:8088/api";
      var authHeader = 'authorization';
  
  /**
   * @ngdoc overview
   * @name lbServices
   * @module
   * @description
   *
   * The `lbServices` module provides services for interacting with
   * the models exposed by the LoopBack server via the REST API.
   *
   */
  var module = angular.module("lbServices", ['ngResource']);
  
  /**
   * @ngdoc object
   * @name lbServices.User
   * @header lbServices.User
   * @object
   *
   * @description
   *
   * A $resource object for interacting with the `User` model.
   *
   * ## Example
   *
   * See
   * {@link http://docs.angularjs.org/api/ngResource.$resource#example $resource}
   * for an example of using this object.
   *
   */
  module.factory(
    "User",
    ['LoopBackResource', 'LoopBackAuth', '$injector', function(Resource, LoopBackAuth, $injector) {
      var R = Resource(
        urlBase + "/Users/:id",
        { 'id': '@id' },
        {
  
          /**
           * @ngdoc method
           * @name lbServices.User#prototype$__findById__accessTokens
           * @methodOf lbServices.User
           *
           * @description
           *
           * Find a related item by id for accessTokens
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `fk` – `{*}` - Foreign key for accessTokens
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "prototype$__findById__accessTokens": {
            url: urlBase + "/Users/:id/accessTokens/:fk",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#prototype$__destroyById__accessTokens
           * @methodOf lbServices.User
           *
           * @description
           *
           * Delete a related item by id for accessTokens
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `fk` – `{*}` - Foreign key for accessTokens
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "prototype$__destroyById__accessTokens": {
            url: urlBase + "/Users/:id/accessTokens/:fk",
            method: "DELETE"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#prototype$__updateById__accessTokens
           * @methodOf lbServices.User
           *
           * @description
           *
           * Update a related item by id for accessTokens
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `fk` – `{*}` - Foreign key for accessTokens
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "prototype$__updateById__accessTokens": {
            url: urlBase + "/Users/:id/accessTokens/:fk",
            method: "PUT"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#prototype$__get__accessTokens
           * @methodOf lbServices.User
           *
           * @description
           *
           * Queries accessTokens of User.
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `filter` – `{object=}` - 
           *
           * @param {function(Array.<Object>,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Array.<Object>} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "prototype$__get__accessTokens": {
            isArray: true,
            url: urlBase + "/Users/:id/accessTokens",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#prototype$__create__accessTokens
           * @methodOf lbServices.User
           *
           * @description
           *
           * Creates a new instance in accessTokens of this model.
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "prototype$__create__accessTokens": {
            url: urlBase + "/Users/:id/accessTokens",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#prototype$__delete__accessTokens
           * @methodOf lbServices.User
           *
           * @description
           *
           * Deletes all accessTokens of this model.
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "prototype$__delete__accessTokens": {
            url: urlBase + "/Users/:id/accessTokens",
            method: "DELETE"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#prototype$__count__accessTokens
           * @methodOf lbServices.User
           *
           * @description
           *
           * Counts accessTokens of User.
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `count` – `{number=}` - 
           */
          "prototype$__count__accessTokens": {
            url: urlBase + "/Users/:id/accessTokens/count",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#create
           * @methodOf lbServices.User
           *
           * @description
           *
           * Create a new instance of the model and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "create": {
            url: urlBase + "/Users",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#upsert
           * @methodOf lbServices.User
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "upsert": {
            url: urlBase + "/Users",
            method: "PUT"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#exists
           * @methodOf lbServices.User
           *
           * @description
           *
           * Check whether a model instance exists in the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `exists` – `{boolean=}` - 
           */
          "exists": {
            url: urlBase + "/Users/:id/exists",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#findById
           * @methodOf lbServices.User
           *
           * @description
           *
           * Find a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "findById": {
            url: urlBase + "/Users/:id",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#find
           * @methodOf lbServices.User
           *
           * @description
           *
           * Find all instances of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Array.<Object>,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Array.<Object>} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "find": {
            isArray: true,
            url: urlBase + "/Users",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#findOne
           * @methodOf lbServices.User
           *
           * @description
           *
           * Find first instance of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "findOne": {
            url: urlBase + "/Users/findOne",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#updateAll
           * @methodOf lbServices.User
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "updateAll": {
            url: urlBase + "/Users/update",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#deleteById
           * @methodOf lbServices.User
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "deleteById": {
            url: urlBase + "/Users/:id",
            method: "DELETE"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#count
           * @methodOf lbServices.User
           *
           * @description
           *
           * Count instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `count` – `{number=}` - 
           */
          "count": {
            url: urlBase + "/Users/count",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#prototype$updateAttributes
           * @methodOf lbServices.User
           *
           * @description
           *
           * Update attributes for a model instance and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          "prototype$updateAttributes": {
            url: urlBase + "/Users/:id",
            method: "PUT"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#login
           * @methodOf lbServices.User
           *
           * @description
           *
           * Login a user with username/email and password
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `include` – `{string=}` - Related objects to include in the response. See the description of return value for more details.
           *   Default value: `user`.
           *
           *  - `rememberMe` - `boolean` - Whether the authentication credentials
           *     should be remembered in localStorage across app/browser restarts.
           *     Default: `true`.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * The response body contains properties of the AccessToken created on login.
           * Depending on the value of `include` parameter, the body may contain additional properties:
           * 
           *   - `user` - `{User}` - Data of the currently logged in user. (`include=user`)
           * 
           *
           */
          "login": {
            params: {
              include: "user"
            },
            interceptor: {
              response: function(response) {
                var accessToken = response.data;
                LoopBackAuth.setUser(accessToken.id, accessToken.userId, accessToken.user);
                LoopBackAuth.rememberMe = response.config.params.rememberMe !== false;
                LoopBackAuth.save();
                return response.resource;
              }
            },
            url: urlBase + "/Users/login",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#logout
           * @methodOf lbServices.User
           *
           * @description
           *
           * Logout a user with access token
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           *  - `access_token` – `{string}` - Do not supply this argument, it is automatically extracted from request headers.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "logout": {
            interceptor: {
              response: function(response) {
                LoopBackAuth.clearUser();
                LoopBackAuth.clearStorage();
                return response.resource;
              }
            },
            url: urlBase + "/Users/logout",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#confirm
           * @methodOf lbServices.User
           *
           * @description
           *
           * Confirm a user registration with email verification token
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `uid` – `{string}` - 
           *
           *  - `token` – `{string}` - 
           *
           *  - `redirect` – `{string}` - 
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "confirm": {
            url: urlBase + "/Users/confirm",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#resetPassword
           * @methodOf lbServices.User
           *
           * @description
           *
           * Reset password for a user with email
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "resetPassword": {
            url: urlBase + "/Users/reset",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.User#getCurrent
           * @methodOf lbServices.User
           *
           * @description
           *
           * Get data of the currently logged user. Fail with HTTP result 401
           * when there is no user logged in.
           *
           * @param {function(Object,Object)=} successCb
           *    Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *    `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           */
          "getCurrent": {
             url: urlBase + "/Users" + "/:id",
             method: "GET",
             params: {
               id: function() {
                var id = LoopBackAuth.currentUserId;
                if (id == null) id = '__anonymous__';
                return id;
              },
            },
            interceptor: {
              response: function(response) {
                LoopBackAuth.currentUserData = response.data;
                return response.resource;
              }
            },
            __isGetCurrentUser__ : true
          }
        }
      );
  
  
  
          /**
           * @ngdoc method
           * @name lbServices.User#updateOrCreate
           * @methodOf lbServices.User
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `User` object.)
           * </em>
           */
          R["updateOrCreate"] = R["upsert"];
  
          /**
           * @ngdoc method
           * @name lbServices.User#update
           * @methodOf lbServices.User
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["update"] = R["updateAll"];
  
          /**
           * @ngdoc method
           * @name lbServices.User#destroyById
           * @methodOf lbServices.User
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["destroyById"] = R["deleteById"];
  
          /**
           * @ngdoc method
           * @name lbServices.User#removeById
           * @methodOf lbServices.User
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["removeById"] = R["deleteById"];
  
          /**
           * @ngdoc method
           * @name lbServices.User#getCachedCurrent
           * @methodOf lbServices.User
           *
           * @description
           *
           * Get data of the currently logged user that was returned by the last
           * call to {@link lbServices.User#login} or
           * {@link lbServices.User#getCurrent}. Return null when there
           * is no user logged in or the data of the current user were not fetched
           * yet.
           *
           * @returns {Object} A User instance.
           */
          R.getCachedCurrent = function() {
            var data = LoopBackAuth.currentUserData;
            return data ? new R(data) : null;
          };
  
          /**
           * @ngdoc method
           * @name lbServices.User#isAuthenticated
           * @methodOf lbServices.User
           *
           * @returns {boolean} True if the current user is authenticated (logged in).
           */
          R.isAuthenticated = function() {
            return this.getCurrentId() != null;
          };
  
          /**
           * @ngdoc method
           * @name lbServices.User#getCurrentId
           * @methodOf lbServices.User
           *
           * @returns {Object} Id of the currently logged-in user or null.
           */
          R.getCurrentId = function() {
            return LoopBackAuth.currentUserId;
          };
  
      /**
      * @ngdoc property
      * @name lbServices.User#modelName
      * @propertyOf lbServices.User
      * @description
      * The name of the model represented by this $resource,
      * i.e. `User`.
      */
      R.modelName = "User";
  
  
      return R;
    }]);
  
  /**
   * @ngdoc object
   * @name lbServices.Location
   * @header lbServices.Location
   * @object
   *
   * @description
   *
   * A $resource object for interacting with the `Location` model.
   *
   * ## Example
   *
   * See
   * {@link http://docs.angularjs.org/api/ngResource.$resource#example $resource}
   * for an example of using this object.
   *
   */
  module.factory(
    "Location",
    ['LoopBackResource', 'LoopBackAuth', '$injector', function(Resource, LoopBackAuth, $injector) {
      var R = Resource(
        urlBase + "/locations/:id",
        { 'id': '@id' },
        {
  
          /**
           * @ngdoc method
           * @name lbServices.Location#create
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Create a new instance of the model and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Location` object.)
           * </em>
           */
          "create": {
            url: urlBase + "/locations",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Location#upsert
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Location` object.)
           * </em>
           */
          "upsert": {
            url: urlBase + "/locations",
            method: "PUT"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Location#exists
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Check whether a model instance exists in the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `exists` – `{boolean=}` - 
           */
          "exists": {
            url: urlBase + "/locations/:id/exists",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Location#findById
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Find a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Location` object.)
           * </em>
           */
          "findById": {
            url: urlBase + "/locations/:id",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Location#find
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Find all instances of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Array.<Object>,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Array.<Object>} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Location` object.)
           * </em>
           */
          "find": {
            isArray: true,
            url: urlBase + "/locations",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Location#findOne
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Find first instance of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Location` object.)
           * </em>
           */
          "findOne": {
            url: urlBase + "/locations/findOne",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Location#updateAll
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "updateAll": {
            url: urlBase + "/locations/update",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Location#deleteById
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "deleteById": {
            url: urlBase + "/locations/:id",
            method: "DELETE"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Location#count
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Count instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `count` – `{number=}` - 
           */
          "count": {
            url: urlBase + "/locations/count",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Location#prototype$updateAttributes
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Update attributes for a model instance and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - PersistedModel id
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Location` object.)
           * </em>
           */
          "prototype$updateAttributes": {
            url: urlBase + "/locations/:id",
            method: "PUT"
          },
        }
      );
  
  
  
          /**
           * @ngdoc method
           * @name lbServices.Location#updateOrCreate
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Location` object.)
           * </em>
           */
          R["updateOrCreate"] = R["upsert"];
  
          /**
           * @ngdoc method
           * @name lbServices.Location#update
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["update"] = R["updateAll"];
  
          /**
           * @ngdoc method
           * @name lbServices.Location#destroyById
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["destroyById"] = R["deleteById"];
  
          /**
           * @ngdoc method
           * @name lbServices.Location#removeById
           * @methodOf lbServices.Location
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["removeById"] = R["deleteById"];
  
  
      /**
      * @ngdoc property
      * @name lbServices.Location#modelName
      * @propertyOf lbServices.Location
      * @description
      * The name of the model represented by this $resource,
      * i.e. `Location`.
      */
      R.modelName = "Location";
  
  
      return R;
    }]);
  
  /**
   * @ngdoc object
   * @name lbServices.Photo
   * @header lbServices.Photo
   * @object
   *
   * @description
   *
   * A $resource object for interacting with the `Photo` model.
   *
   * ## Example
   *
   * See
   * {@link http://docs.angularjs.org/api/ngResource.$resource#example $resource}
   * for an example of using this object.
   *
   */
  module.factory(
    "Photo",
    ['LoopBackResource', 'LoopBackAuth', '$injector', function(Resource, LoopBackAuth, $injector) {
      var R = Resource(
        urlBase + "/photos/:id",
        { 'id': '@id' },
        {
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#create
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Create a new instance of the model and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Photo` object.)
           * </em>
           */
          "create": {
            url: urlBase + "/photos",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#upsert
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Photo` object.)
           * </em>
           */
          "upsert": {
            url: urlBase + "/photos",
            method: "PUT"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#exists
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Check whether a model instance exists in the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `exists` – `{boolean=}` - 
           */
          "exists": {
            url: urlBase + "/photos/:id/exists",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#findById
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Find a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Photo` object.)
           * </em>
           */
          "findById": {
            url: urlBase + "/photos/:id",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#find
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Find all instances of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Array.<Object>,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Array.<Object>} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Photo` object.)
           * </em>
           */
          "find": {
            isArray: true,
            url: urlBase + "/photos",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#findOne
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Find first instance of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Photo` object.)
           * </em>
           */
          "findOne": {
            url: urlBase + "/photos/findOne",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#updateAll
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "updateAll": {
            url: urlBase + "/photos/update",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#deleteById
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "deleteById": {
            url: urlBase + "/photos/:id",
            method: "DELETE"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#count
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Count instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `count` – `{number=}` - 
           */
          "count": {
            url: urlBase + "/photos/count",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#prototype$updateAttributes
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Update attributes for a model instance and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - PersistedModel id
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Photo` object.)
           * </em>
           */
          "prototype$updateAttributes": {
            url: urlBase + "/photos/:id",
            method: "PUT"
          },
        }
      );
  
  
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#updateOrCreate
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Photo` object.)
           * </em>
           */
          R["updateOrCreate"] = R["upsert"];
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#update
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["update"] = R["updateAll"];
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#destroyById
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["destroyById"] = R["deleteById"];
  
          /**
           * @ngdoc method
           * @name lbServices.Photo#removeById
           * @methodOf lbServices.Photo
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["removeById"] = R["deleteById"];
  
  
      /**
      * @ngdoc property
      * @name lbServices.Photo#modelName
      * @propertyOf lbServices.Photo
      * @description
      * The name of the model represented by this $resource,
      * i.e. `Photo`.
      */
      R.modelName = "Photo";
  
  
      return R;
    }]);
  
  /**
   * @ngdoc object
   * @name lbServices.Poi
   * @header lbServices.Poi
   * @object
   *
   * @description
   *
   * A $resource object for interacting with the `Poi` model.
   *
   * ## Example
   *
   * See
   * {@link http://docs.angularjs.org/api/ngResource.$resource#example $resource}
   * for an example of using this object.
   *
   */
  module.factory(
    "Poi",
    ['LoopBackResource', 'LoopBackAuth', '$injector', function(Resource, LoopBackAuth, $injector) {
      var R = Resource(
        urlBase + "/pois/:id",
        { 'id': '@id' },
        {
  
          // INTERNAL. Use Poi.amUser() instead.
          "prototype$__get__amUser": {
            url: urlBase + "/pois/:id/amUser",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#create
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Create a new instance of the model and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Poi` object.)
           * </em>
           */
          "create": {
            url: urlBase + "/pois",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#upsert
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Poi` object.)
           * </em>
           */
          "upsert": {
            url: urlBase + "/pois",
            method: "PUT"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#exists
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Check whether a model instance exists in the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `exists` – `{boolean=}` - 
           */
          "exists": {
            url: urlBase + "/pois/:id/exists",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#findById
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Find a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Poi` object.)
           * </em>
           */
          "findById": {
            url: urlBase + "/pois/:id",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#find
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Find all instances of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Array.<Object>,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Array.<Object>} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Poi` object.)
           * </em>
           */
          "find": {
            isArray: true,
            url: urlBase + "/pois",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#findOne
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Find first instance of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Poi` object.)
           * </em>
           */
          "findOne": {
            url: urlBase + "/pois/findOne",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#updateAll
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "updateAll": {
            url: urlBase + "/pois/update",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#deleteById
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "deleteById": {
            url: urlBase + "/pois/:id",
            method: "DELETE"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#count
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Count instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `count` – `{number=}` - 
           */
          "count": {
            url: urlBase + "/pois/count",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#prototype$updateAttributes
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Update attributes for a model instance and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - PersistedModel id
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Poi` object.)
           * </em>
           */
          "prototype$updateAttributes": {
            url: urlBase + "/pois/:id",
            method: "PUT"
          },
        }
      );
  
  
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#updateOrCreate
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `Poi` object.)
           * </em>
           */
          R["updateOrCreate"] = R["upsert"];
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#update
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["update"] = R["updateAll"];
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#destroyById
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["destroyById"] = R["deleteById"];
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#removeById
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["removeById"] = R["deleteById"];
  
  
      /**
      * @ngdoc property
      * @name lbServices.Poi#modelName
      * @propertyOf lbServices.Poi
      * @description
      * The name of the model represented by this $resource,
      * i.e. `Poi`.
      */
      R.modelName = "Poi";
  
  
          /**
           * @ngdoc method
           * @name lbServices.Poi#amUser
           * @methodOf lbServices.Poi
           *
           * @description
           *
           * Fetches belongsTo relation amUser
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - PersistedModel id
           *
           *  - `refresh` – `{boolean=}` - 
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          R.amUser = function() {
            var TargetResource = $injector.get("AmUser");
            var action = TargetResource["::get::poi::amUser"];
            return action.apply(R, arguments);
          };
  
      return R;
    }]);
  
  /**
   * @ngdoc object
   * @name lbServices.AmUser
   * @header lbServices.AmUser
   * @object
   *
   * @description
   *
   * A $resource object for interacting with the `AmUser` model.
   *
   * ## Example
   *
   * See
   * {@link http://docs.angularjs.org/api/ngResource.$resource#example $resource}
   * for an example of using this object.
   *
   */
  module.factory(
    "AmUser",
    ['LoopBackResource', 'LoopBackAuth', '$injector', function(Resource, LoopBackAuth, $injector) {
      var R = Resource(
        urlBase + "/AmUsers/:id",
        { 'id': '@id' },
        {
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#prototype$__findById__accessTokens
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Find a related item by id for accessTokens
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `fk` – `{*}` - Foreign key for accessTokens
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "prototype$__findById__accessTokens": {
            url: urlBase + "/AmUsers/:id/accessTokens/:fk",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#prototype$__destroyById__accessTokens
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Delete a related item by id for accessTokens
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `fk` – `{*}` - Foreign key for accessTokens
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "prototype$__destroyById__accessTokens": {
            url: urlBase + "/AmUsers/:id/accessTokens/:fk",
            method: "DELETE"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#prototype$__updateById__accessTokens
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Update a related item by id for accessTokens
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `fk` – `{*}` - Foreign key for accessTokens
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "prototype$__updateById__accessTokens": {
            url: urlBase + "/AmUsers/:id/accessTokens/:fk",
            method: "PUT"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#prototype$__get__accessTokens
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Queries accessTokens of AmUser.
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `filter` – `{object=}` - 
           *
           * @param {function(Array.<Object>,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Array.<Object>} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "prototype$__get__accessTokens": {
            isArray: true,
            url: urlBase + "/AmUsers/:id/accessTokens",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#prototype$__create__accessTokens
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Creates a new instance in accessTokens of this model.
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "prototype$__create__accessTokens": {
            url: urlBase + "/AmUsers/:id/accessTokens",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#prototype$__delete__accessTokens
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Deletes all accessTokens of this model.
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "prototype$__delete__accessTokens": {
            url: urlBase + "/AmUsers/:id/accessTokens",
            method: "DELETE"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#prototype$__count__accessTokens
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Counts accessTokens of AmUser.
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `count` – `{number=}` - 
           */
          "prototype$__count__accessTokens": {
            url: urlBase + "/AmUsers/:id/accessTokens/count",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#create
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Create a new instance of the model and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "create": {
            url: urlBase + "/AmUsers",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#upsert
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "upsert": {
            url: urlBase + "/AmUsers",
            method: "PUT"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#exists
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Check whether a model instance exists in the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `exists` – `{boolean=}` - 
           */
          "exists": {
            url: urlBase + "/AmUsers/:id/exists",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#findById
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Find a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "findById": {
            url: urlBase + "/AmUsers/:id",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#find
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Find all instances of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Array.<Object>,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Array.<Object>} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "find": {
            isArray: true,
            url: urlBase + "/AmUsers",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#findOne
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Find first instance of the model matched by filter from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `filter` – `{object=}` - Filter defining fields, where, orderBy, offset, and limit
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "findOne": {
            url: urlBase + "/AmUsers/findOne",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#updateAll
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "updateAll": {
            url: urlBase + "/AmUsers/update",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#deleteById
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "deleteById": {
            url: urlBase + "/AmUsers/:id",
            method: "DELETE"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#count
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Count instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * Data properties:
           *
           *  - `count` – `{number=}` - 
           */
          "count": {
            url: urlBase + "/AmUsers/count",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#prototype$updateAttributes
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Update attributes for a model instance and persist it into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - User id
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          "prototype$updateAttributes": {
            url: urlBase + "/AmUsers/:id",
            method: "PUT"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#login
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Login a user with username/email and password
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `include` – `{string=}` - Related objects to include in the response. See the description of return value for more details.
           *   Default value: `user`.
           *
           *  - `rememberMe` - `boolean` - Whether the authentication credentials
           *     should be remembered in localStorage across app/browser restarts.
           *     Default: `true`.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * The response body contains properties of the AccessToken created on login.
           * Depending on the value of `include` parameter, the body may contain additional properties:
           * 
           *   - `user` - `{User}` - Data of the currently logged in user. (`include=user`)
           * 
           *
           */
          "login": {
            params: {
              include: "user"
            },
            interceptor: {
              response: function(response) {
                var accessToken = response.data;
                LoopBackAuth.setUser(accessToken.id, accessToken.userId, accessToken.user);
                LoopBackAuth.rememberMe = response.config.params.rememberMe !== false;
                LoopBackAuth.save();
                return response.resource;
              }
            },
            url: urlBase + "/AmUsers/login",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#logout
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Logout a user with access token
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           *  - `access_token` – `{string}` - Do not supply this argument, it is automatically extracted from request headers.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "logout": {
            interceptor: {
              response: function(response) {
                LoopBackAuth.clearUser();
                LoopBackAuth.clearStorage();
                return response.resource;
              }
            },
            url: urlBase + "/AmUsers/logout",
            method: "POST"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#confirm
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Confirm a user registration with email verification token
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `uid` – `{string}` - 
           *
           *  - `token` – `{string}` - 
           *
           *  - `redirect` – `{string}` - 
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "confirm": {
            url: urlBase + "/AmUsers/confirm",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#resetPassword
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Reset password for a user with email
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          "resetPassword": {
            url: urlBase + "/AmUsers/reset",
            method: "POST"
          },
  
          // INTERNAL. Use Poi.amUser() instead.
          "::get::poi::amUser": {
            url: urlBase + "/pois/:id/amUser",
            method: "GET"
          },
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#getCurrent
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Get data of the currently logged user. Fail with HTTP result 401
           * when there is no user logged in.
           *
           * @param {function(Object,Object)=} successCb
           *    Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *    `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           */
          "getCurrent": {
             url: urlBase + "/AmUsers" + "/:id",
             method: "GET",
             params: {
               id: function() {
                var id = LoopBackAuth.currentUserId;
                if (id == null) id = '__anonymous__';
                return id;
              },
            },
            interceptor: {
              response: function(response) {
                LoopBackAuth.currentUserData = response.data;
                return response.resource;
              }
            },
            __isGetCurrentUser__ : true
          }
        }
      );
  
  
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#updateOrCreate
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Update an existing model instance or insert a new one into the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *   This method does not accept any parameters.
           *   Supply an empty object or omit this argument altogether.
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * <em>
           * (The remote method definition does not provide any description.
           * This usually means the response is a `AmUser` object.)
           * </em>
           */
          R["updateOrCreate"] = R["upsert"];
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#update
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Update instances of the model matched by where from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `where` – `{object=}` - Criteria to match model instances
           *
           * @param {Object} postData Request data.
           *
           * This method expects a subset of model properties as request parameters.
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["update"] = R["updateAll"];
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#destroyById
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["destroyById"] = R["deleteById"];
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#removeById
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Delete a model instance by id from the data source
           *
           * @param {Object=} parameters Request parameters.
           *
           *  - `id` – `{*}` - Model id
           *
           * @param {function(Object,Object)=} successCb
           *   Success callback with two arguments: `value`, `responseHeaders`.
           *
           * @param {function(Object)=} errorCb Error callback with one argument:
           *   `httpResponse`.
           *
           * @returns {Object} An empty reference that will be
           *   populated with the actual data once the response is returned
           *   from the server.
           *
           * This method returns no data.
           */
          R["removeById"] = R["deleteById"];
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#getCachedCurrent
           * @methodOf lbServices.AmUser
           *
           * @description
           *
           * Get data of the currently logged user that was returned by the last
           * call to {@link lbServices.AmUser#login} or
           * {@link lbServices.AmUser#getCurrent}. Return null when there
           * is no user logged in or the data of the current user were not fetched
           * yet.
           *
           * @returns {Object} A AmUser instance.
           */
          R.getCachedCurrent = function() {
            var data = LoopBackAuth.currentUserData;
            return data ? new R(data) : null;
          };
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#isAuthenticated
           * @methodOf lbServices.AmUser
           *
           * @returns {boolean} True if the current user is authenticated (logged in).
           */
          R.isAuthenticated = function() {
            return this.getCurrentId() != null;
          };
  
          /**
           * @ngdoc method
           * @name lbServices.AmUser#getCurrentId
           * @methodOf lbServices.AmUser
           *
           * @returns {Object} Id of the currently logged-in user or null.
           */
          R.getCurrentId = function() {
            return LoopBackAuth.currentUserId;
          };
  
      /**
      * @ngdoc property
      * @name lbServices.AmUser#modelName
      * @propertyOf lbServices.AmUser
      * @description
      * The name of the model represented by this $resource,
      * i.e. `AmUser`.
      */
      R.modelName = "AmUser";
  
  
      return R;
    }]);
  
  
  module
    .factory('LoopBackAuth', function() {
      var props = ['accessTokenId', 'currentUserId'];
      var propsPrefix = '$LoopBack$';
  
      function LoopBackAuth() {
        var self = this;
        props.forEach(function(name) {
          self[name] = load(name);
        });
        this.rememberMe = undefined;
        this.currentUserData = null;
      }
  
      LoopBackAuth.prototype.save = function() {
        var self = this;
        var storage = this.rememberMe ? localStorage : sessionStorage;
        props.forEach(function(name) {
          save(storage, name, self[name]);
        });
      };
  
      LoopBackAuth.prototype.setUser = function(accessTokenId, userId, userData) {
        this.accessTokenId = accessTokenId;
        this.currentUserId = userId;
        this.currentUserData = userData;
      }
  
      LoopBackAuth.prototype.clearUser = function() {
        this.accessTokenId = null;
        this.currentUserId = null;
        this.currentUserData = null;
      }
  
      LoopBackAuth.prototype.clearStorage = function() {
        props.forEach(function(name) {
          save(sessionStorage, name, null);
          save(localStorage, name, null);
        });
      };
  
      return new LoopBackAuth();
  
      // Note: LocalStorage converts the value to string
      // We are using empty string as a marker for null/undefined values.
      function save(storage, name, value) {
        var key = propsPrefix + name;
        if (value == null) value = '';
        storage[key] = value;
      }
  
      function load(name) {
        var key = propsPrefix + name;
        return localStorage[key] || sessionStorage[key] || null;
      }
    })
    .config(['$httpProvider', function($httpProvider) {
      $httpProvider.interceptors.push('LoopBackAuthRequestInterceptor');
    }])
    .factory('LoopBackAuthRequestInterceptor', [ '$q', 'LoopBackAuth',
      function($q, LoopBackAuth) {
        return {
          'request': function(config) {
  
            // filter out non urlBase requests
            if (config.url.substr(0, urlBase.length) !== urlBase) {
              return config;
            }
  
            if (LoopBackAuth.accessTokenId) {
              config.headers[authHeader] = LoopBackAuth.accessTokenId;
            } else if (config.__isGetCurrentUser__) {
              // Return a stub 401 error for User.getCurrent() when
              // there is no user logged in
              var res = {
                body: { error: { status: 401 } },
                status: 401,
                config: config,
                headers: function() { return undefined; }
              };
              return $q.reject(res);
            }
            return config || $q.when(config);
          }
        }
      }])
  
    /**
     * @ngdoc object
     * @name lbServices.LoopBackResourceProvider
     * @header lbServices.LoopBackResourceProvider
     * @description
     * Use `LoopBackResourceProvider` to change the global configuration
     * settings used by all models. Note that the provider is available
     * to Configuration Blocks only, see
     * {@link https://docs.angularjs.org/guide/module#module-loading-dependencies Module Loading & Dependencies}
     * for more details.
     *
     * ## Example
     *
     * ```js
     * angular.module('app')
     *  .config(function(LoopBackResourceProvider) {
     *     LoopBackResourceProvider.setAuthHeader('X-Access-Token');
     *  });
     * ```
     */
    .provider('LoopBackResource', function LoopBackResourceProvider() {
      /**
       * @ngdoc method
       * @name lbServices.LoopBackResourceProvider#setAuthHeader
       * @methodOf lbServices.LoopBackResourceProvider
       * @param {string} header The header name to use, e.g. `X-Access-Token`
       * @description
       * Configure the REST transport to use a different header for sending
       * the authentication token. It is sent in the `Authorization` header
       * by default.
       */
      this.setAuthHeader = function(header) {
        authHeader = header;
      };
  
      /**
       * @ngdoc method
       * @name lbServices.LoopBackResourceProvider#setUrlBase
       * @methodOf lbServices.LoopBackResourceProvider
       * @param {string} url The URL to use, e.g. `/api` or `//example.com/api`.
       * @description
       * Change the URL of the REST API server. By default, the URL provided
       * to the code generator (`lb-ng` or `grunt-loopback-sdk-angular`) is used.
       */
      this.setUrlBase = function(url) {
        urlBase = url;
      };
  
      this.$get = ['$resource', function($resource) {
        return function(url, params, actions) {
          var resource = $resource(url, params, actions);
  
          // Angular always calls POST on $save()
          // This hack is based on
          // http://kirkbushell.me/angular-js-using-ng-resource-in-a-more-restful-manner/
          resource.prototype.$save = function(success, error) {
            // Fortunately, LoopBack provides a convenient `upsert` method
            // that exactly fits our needs.
            var result = resource.upsert.call(this, {}, this, success, error);
            return result.$promise || result;
          };
          return resource;
        };
      }];
    });
  
  })(window, window.angular);
  