"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.User = exports.UserStatus = exports.UserRole = void 0; const typeorm_1 = require("typeorm"); const tenant_entity_1 = require("./tenant.entity"); var UserRole; (function (UserRole) { UserRole["OWNER"] = "owner"; UserRole["ADMIN"] = "admin"; UserRole["EMPLOYEE"] = "employee"; })(UserRole || (exports.UserRole = UserRole = {})); var UserStatus; (function (UserStatus) { UserStatus["ACTIVE"] = "active"; UserStatus["INACTIVE"] = "inactive"; UserStatus["SUSPENDED"] = "suspended"; })(UserStatus || (exports.UserStatus = UserStatus = {})); let User = class User { }; exports.User = User; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), __metadata("design:type", String) ], User.prototype, "id", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'tenant_id' }), __metadata("design:type", String) ], User.prototype, "tenantId", void 0); __decorate([ (0, typeorm_1.Column)({ length: 20 }), __metadata("design:type", String) ], User.prototype, "phone", void 0); __decorate([ (0, typeorm_1.Column)({ length: 100, nullable: true }), __metadata("design:type", String) ], User.prototype, "email", void 0); __decorate([ (0, typeorm_1.Column)({ length: 100 }), __metadata("design:type", String) ], User.prototype, "name", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'pin_hash', length: 255, nullable: true }), __metadata("design:type", String) ], User.prototype, "pinHash", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'biometric_enabled', default: false }), __metadata("design:type", Boolean) ], User.prototype, "biometricEnabled", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'biometric_key', type: 'text', nullable: true }), __metadata("design:type", String) ], User.prototype, "biometricKey", void 0); __decorate([ (0, typeorm_1.Column)({ length: 20, default: 'owner' }), __metadata("design:type", String) ], User.prototype, "role", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'jsonb', default: {} }), __metadata("design:type", Object) ], User.prototype, "permissions", void 0); __decorate([ (0, typeorm_1.Column)({ length: 20, default: 'active' }), __metadata("design:type", String) ], User.prototype, "status", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'last_login_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Date) ], User.prototype, "lastLoginAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'failed_attempts', default: 0 }), __metadata("design:type", Number) ], User.prototype, "failedAttempts", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'locked_until', type: 'timestamptz', nullable: true }), __metadata("design:type", Date) ], User.prototype, "lockedUntil", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }), __metadata("design:type", Date) ], User.prototype, "createdAt", void 0); __decorate([ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }), __metadata("design:type", Date) ], User.prototype, "updatedAt", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => tenant_entity_1.Tenant, (tenant) => tenant.users), (0, typeorm_1.JoinColumn)({ name: 'tenant_id' }), __metadata("design:type", tenant_entity_1.Tenant) ], User.prototype, "tenant", void 0); exports.User = User = __decorate([ (0, typeorm_1.Entity)({ schema: 'auth', name: 'users' }) ], User); //# sourceMappingURL=user.entity.js.map