/* global angular, api_url */

angular.module("app").service("AuthService", [
    '$uhttp',
    function ($uhttp) {
        // ----- GET -----
        this.logout = function () {
            return $uhttp({
                url: api_url + 'auth/logout?v=' + Math.random(1000 - 1) + 1
            });
        };
        // ----- POST -----
        this.login = function (data) {
            return $uhttp({
                url: api_url + 'auth/acceso?v=' + Math.random(1000 - 1) + 1,
                method: 'post',
                data: data
            });
        };
        this.sessionActiva = function () {
            return $uhttp({
                url: api_url + 'auth/session_activa?v=' + Math.random(1000 - 1) + 1
            });
        };
        this.verificarCodigo = function (data) {
            return $uhttp({
                url: api_url + 'auth/verificar_codigo?v=' + Math.random(1000 - 1) + 1,
                method: 'post',
                data: data
            });
        };
        this.validateAndSendCorreo = function (data) {
            return $uhttp({
                url: api_url + 'auth/validate_and_send_correo?v=' + Math.random(1000 - 1) + 1,
                method: 'post',
                data: data
            });
        };
        this.confirmarAcceso = function (data) {
            return $uhttp({
                url: api_url + 'auth/confirmar_acceso?v=' + Math.random(1000 - 1) + 1,
                method: 'post',
                data: data
            });
        };
    }
]);