"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.ContextTemplate = exports.TemplateType = void 0;
const typeorm_1 = require("typeorm");
const swagger_1 = require("@nestjs/swagger");
const base_entity_1 = require("./base.entity");
const session_entity_1 = require("./session.entity");
const session_input_entity_1 = require("./session-input.entity");
const enums_1 = require("./enums");
var enums_2 = require("./enums");
Object.defineProperty(exports, "TemplateType", { enumerable: true, get: function () { return enums_2.TemplateType; } });
let ContextTemplate = class ContextTemplate extends base_entity_1.BaseEntity {
};
exports.ContextTemplate = ContextTemplate;
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Human-readable name for this template',
        example: 'Full Project Context',
    }),
    (0, typeorm_1.Column)({ type: 'text' }),
    __metadata("design:type", String)
], ContextTemplate.prototype, "template_name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Eta template content. Supports it.files, it.folders, it.tools variables.',
    }),
    (0, typeorm_1.Column)({ type: 'text' }),
    __metadata("design:type", String)
], ContextTemplate.prototype, "template_content", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'JSON string defining files/folders to include',
        example: '{"files": ["src/index.ts"], "folders": ["src/components"]}',
    }),
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", String)
], ContextTemplate.prototype, "context_definition", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Whether this is the default for initial prompts',
        example: false,
        default: false,
    }),
    (0, typeorm_1.Column)({ type: 'boolean', default: false }),
    __metadata("design:type", Boolean)
], ContextTemplate.prototype, "is_default_initial", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Whether this is the default for follow-up prompts',
        example: false,
        default: false,
    }),
    (0, typeorm_1.Column)({ type: 'boolean', default: false }),
    __metadata("design:type", Boolean)
], ContextTemplate.prototype, "is_default_followup", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Whether this is the default for condensed history',
        example: false,
        default: false,
    }),
    (0, typeorm_1.Column)({ type: 'boolean', default: false }),
    __metadata("design:type", Boolean)
], ContextTemplate.prototype, "is_default_condensed", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Template type: main (full template) or partial (reusable block)',
        enum: enums_1.TemplateType,
        enumName: 'TemplateType',
        example: enums_1.TemplateType.MAIN,
    }),
    (0, typeorm_1.Column)({
        type: 'text',
        enum: enums_1.TemplateType,
        default: enums_1.TemplateType.MAIN,
    }),
    __metadata("design:type", String)
], ContextTemplate.prototype, "template_type", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Sessions that use this as initial default',
        type: () => [session_entity_1.Session],
    }),
    (0, typeorm_1.OneToMany)(() => session_entity_1.Session, (session) => session.defaultInitialContextTemplate),
    __metadata("design:type", Array)
], ContextTemplate.prototype, "sessionsAsInitialDefault", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Sessions that use this as followup default',
        type: () => [session_entity_1.Session],
    }),
    (0, typeorm_1.OneToMany)(() => session_entity_1.Session, (session) => session.defaultFollowupContextTemplate),
    __metadata("design:type", Array)
], ContextTemplate.prototype, "sessionsAsFollowupDefault", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Whether this is a built-in seed template (immutable)',
        example: false,
        default: false,
    }),
    (0, typeorm_1.Column)({ type: 'boolean', default: false }),
    __metadata("design:type", Boolean)
], ContextTemplate.prototype, "is_builtin", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Unique key for built-in templates (used for version updates)',
        example: 'initial-full-project-context',
    }),
    (0, typeorm_1.Column)({ type: 'text', nullable: true, unique: true }),
    __metadata("design:type", String)
], ContextTemplate.prototype, "builtin_key", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'SessionInputs that used this template',
        type: () => [session_input_entity_1.SessionInput],
    }),
    (0, typeorm_1.OneToMany)(() => session_input_entity_1.SessionInput, (sessionInput) => sessionInput.contextTemplate),
    __metadata("design:type", Array)
], ContextTemplate.prototype, "sessionInputs", void 0);
exports.ContextTemplate = ContextTemplate = __decorate([
    (0, typeorm_1.Entity)('context_templates')
], ContextTemplate);
//# sourceMappingURL=context-template.entity.js.map