"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.NestAuthRolePermission = void 0;
const typeorm_1 = require("typeorm");
const permission_entity_1 = require("../../permission/entities/permission.entity");
const role_entity_1 = require("./role.entity");
let NestAuthRolePermission = class NestAuthRolePermission extends typeorm_1.BaseEntity {
    id;
    roleId;
    permissionId;
    role;
    permission;
    createdAt;
};
exports.NestAuthRolePermission = NestAuthRolePermission;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], NestAuthRolePermission.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    (0, typeorm_1.Index)(),
    (0, typeorm_1.RelationId)((rolePermission) => rolePermission.role),
    __metadata("design:type", String)
], NestAuthRolePermission.prototype, "roleId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    (0, typeorm_1.Index)(),
    (0, typeorm_1.RelationId)((rolePermission) => rolePermission.permission),
    __metadata("design:type", String)
], NestAuthRolePermission.prototype, "permissionId", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => role_entity_1.NestAuthRole, role => role.rolePermissions, { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'roleId' }),
    __metadata("design:type", role_entity_1.NestAuthRole)
], NestAuthRolePermission.prototype, "role", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => permission_entity_1.NestAuthPermission, permission => permission.rolePermissions, { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'permissionId' }),
    __metadata("design:type", permission_entity_1.NestAuthPermission)
], NestAuthRolePermission.prototype, "permission", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)(),
    __metadata("design:type", Date)
], NestAuthRolePermission.prototype, "createdAt", void 0);
exports.NestAuthRolePermission = NestAuthRolePermission = __decorate([
    (0, typeorm_1.Entity)('nest_auth_role_permissions'),
    (0, typeorm_1.Unique)('UQ_role_permission_unique', ['roleId', 'permissionId'])
], NestAuthRolePermission);
//# sourceMappingURL=role-permission.entity.js.map