"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.WorkflowBuilderSession = void 0;
const node_crypto_1 = require("node:crypto");
const db_1 = require("@n8n/db");
const typeorm_1 = require("@n8n/typeorm");
let WorkflowBuilderSession = class WorkflowBuilderSession extends db_1.WithTimestamps {
    generateId() {
        if (!this.id) {
            this.id = (0, node_crypto_1.randomUUID)();
        }
    }
};
exports.WorkflowBuilderSession = WorkflowBuilderSession;
__decorate([
    (0, typeorm_1.PrimaryColumn)('uuid'),
    __metadata("design:type", String)
], WorkflowBuilderSession.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.BeforeInsert)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], WorkflowBuilderSession.prototype, "generateId", null);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 36 }),
    __metadata("design:type", String)
], WorkflowBuilderSession.prototype, "workflowId", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)('WorkflowEntity', { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'workflowId' }),
    __metadata("design:type", Object)
], WorkflowBuilderSession.prototype, "workflow", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    __metadata("design:type", String)
], WorkflowBuilderSession.prototype, "userId", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)('User', { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'userId' }),
    __metadata("design:type", Object)
], WorkflowBuilderSession.prototype, "user", void 0);
__decorate([
    (0, db_1.JsonColumn)({ default: '[]' }),
    __metadata("design:type", Array)
], WorkflowBuilderSession.prototype, "messages", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true, default: null }),
    __metadata("design:type", Object)
], WorkflowBuilderSession.prototype, "previousSummary", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true, default: null }),
    __metadata("design:type", Object)
], WorkflowBuilderSession.prototype, "activeVersionCardId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true, default: null }),
    __metadata("design:type", Object)
], WorkflowBuilderSession.prototype, "resumeAfterRestoreMessageId", void 0);
exports.WorkflowBuilderSession = WorkflowBuilderSession = __decorate([
    (0, typeorm_1.Entity)({ name: 'workflow_builder_session' }),
    (0, typeorm_1.Unique)(['workflowId', 'userId'])
], WorkflowBuilderSession);
//# sourceMappingURL=workflow-builder-session.entity.js.map