{"ast":null,"code":"import { HttpHeaders } from '@angular/common/http';\nimport { environment } from '../environments/environment';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"@angular/common/http\";\nimport * as i2 from \"./user.service\";\nexport let AuthService = /*#__PURE__*/(() => {\n  class AuthService {\n    constructor(http, userService) {\n      this.http = http;\n      this.userService = userService;\n      this.apiUrl = `${environment.apiUrlBackEnd}/api/auth/login`;\n      this.loggedInStatus = false;\n      this.userId = 0;\n      this.userName = '';\n      this.userRole = '';\n      this.functionalities = []; // ✅ FALTAVA DECLARAR ESSA VARIÁVEL\n    }\n    login(username, password) {\n      const headers = new HttpHeaders({\n        'Content-Type': 'application/x-www-form-urlencoded'\n      });\n      const body = new URLSearchParams();\n      body.set('username', username);\n      body.set('password', password);\n      return this.http.post(this.apiUrl, body.toString(), {\n        headers\n      });\n    }\n    setUserData(userId, name, role, functionalities) {\n      this.userId = userId;\n      this.userName = name;\n      this.userRole = role;\n      this.functionalities = Array.isArray(functionalities) ? functionalities.map(f => f.toLowerCase()) : [];\n      this.loggedInStatus = true;\n    }\n    setLoggedOut() {\n      this.loggedInStatus = false;\n      this.userId = 0;\n      this.userName = '';\n      this.userRole = '';\n      this.functionalities = [];\n      this.userService.clearUserId();\n    }\n    isLoggedIn() {\n      return this.loggedInStatus;\n    }\n    getUserName() {\n      return this.userName;\n    }\n    getUserRole() {\n      return this.userRole;\n    }\n    getUserId() {\n      return this.userId;\n    }\n    hasFunctionality(func) {\n      const access = this.userService.getUserAccessData();\n      if (!access || !access.parkingAccess) return false;\n      return access.parkingAccess.flatMap(p => p.functionalities || []).some(f => f.toLowerCase() === func.toLowerCase());\n    }\n    getFunctionalities() {\n      return this.functionalities;\n    }\n    static #_ = this.ɵfac = function AuthService_Factory(t) {\n      return new (t || AuthService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(i2.UserService));\n    };\n    static #_2 = this.ɵprov = /*@__PURE__*/i0.ɵɵdefineInjectable({\n      token: AuthService,\n      factory: AuthService.ɵfac,\n      providedIn: 'root'\n    });\n  }\n  return AuthService;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}