/*****************************************************************************\
|                                               ( )_  _                       |
|    _ _    _ __   _ _    __    ___ ___     _ _ | ,_)(_)  ___   ___     _     |
|   ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| |  | |/',__)/' v `\ /'_`\   |
|   | (_) )| |  ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) )  |
|   | ,__/'(_)  `\__,_)`\__  |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/'  |
|   | |                ( )_) |                                                |
|   (_)                 \___/'                                                |
|                                                                             |
| General Bots Copyright (c) Pragmatismo.io. All rights reserved.             |
| Licensed under the AGPL-3.0.                                                |
|                                                                             |
| According to our dual licensing model, this program can be used either      |
| under the terms of the GNU Affero General Public License, version 3,        |
| or under a proprietary license.                                             |
|                                                                             |
| The texts of the GNU Affero General Public License with an additional       |
| permission and of our proprietary license can be found at and               |
| in the LICENSE file you have received along with this program.              |
|                                                                             |
| This program is distributed in the hope that it will be useful,             |
| but WITHOUT ANY WARRANTY, without even the implied warranty of              |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                |
| GNU Affero General Public License for more details.                         |
|                                                                             |
| "General Bots" is a registered trademark of Pragmatismo.io.                 |
| The licensing of the program under the AGPLv3 does not imply a              |
| trademark license. Therefore any rights, title and interest in              |
| our trademarks remain entirely with us.                                     |
|                                                                             |
\*****************************************************************************/
/**
 * @fileoverview General Bots server core.
 */
'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);
};
var GuaribasSubject_1;
import { AutoIncrement, BelongsTo, Column, CreatedAt, DataType, ForeignKey, HasMany, HasOne, Length, Model, PrimaryKey, Table, UpdatedAt } from 'sequelize-typescript';
import { GuaribasInstance, GuaribasPackage } from '../../core.gbapp/models/GBModel.js';
import { GuaribasUser } from '../../security.gbapp/models/index.js';
/**
 * Subjects to group the pair of questions and answers.
 */
let GuaribasSubject = GuaribasSubject_1 = class GuaribasSubject extends Model {
    parentSubject;
};
__decorate([
    PrimaryKey,
    AutoIncrement,
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasSubject.prototype, "subjectId", void 0);
__decorate([
    Column(DataType.STRING(255)),
    __metadata("design:type", String)
], GuaribasSubject.prototype, "internalId", void 0);
__decorate([
    Column(DataType.STRING(512)),
    __metadata("design:type", String)
], GuaribasSubject.prototype, "description", void 0);
__decorate([
    Column(DataType.STRING(255)),
    __metadata("design:type", String)
], GuaribasSubject.prototype, "from", void 0);
__decorate([
    Column(DataType.STRING(255)),
    __metadata("design:type", String)
], GuaribasSubject.prototype, "to", void 0);
__decorate([
    ForeignKey(() => GuaribasSubject_1),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasSubject.prototype, "parentSubjectId", void 0);
__decorate([
    BelongsTo(() => GuaribasSubject_1, 'parentSubjectId'),
    __metadata("design:type", GuaribasSubject)
], GuaribasSubject.prototype, "parentSubject", void 0);
__decorate([
    HasMany(() => GuaribasSubject_1, { foreignKey: 'parentSubjectId' }),
    __metadata("design:type", Array)
], GuaribasSubject.prototype, "childrenSubjects", void 0);
__decorate([
    ForeignKey(() => GuaribasInstance),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasSubject.prototype, "instanceId", void 0);
__decorate([
    BelongsTo(() => GuaribasInstance),
    __metadata("design:type", GuaribasInstance)
], GuaribasSubject.prototype, "instance", void 0);
__decorate([
    ForeignKey(() => GuaribasUser),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasSubject.prototype, "responsibleUserId", void 0);
__decorate([
    BelongsTo(() => GuaribasUser),
    __metadata("design:type", GuaribasUser)
], GuaribasSubject.prototype, "responsibleUser", void 0);
__decorate([
    ForeignKey(() => GuaribasPackage),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasSubject.prototype, "packageId", void 0);
__decorate([
    BelongsTo(() => GuaribasPackage),
    __metadata("design:type", GuaribasPackage)
], GuaribasSubject.prototype, "package", void 0);
GuaribasSubject = GuaribasSubject_1 = __decorate([
    Table
], GuaribasSubject);
export { GuaribasSubject };
/**
 * A question and its metadata.
 */
let GuaribasQuestion = class GuaribasQuestion extends Model {
    package;
};
__decorate([
    PrimaryKey,
    AutoIncrement,
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasQuestion.prototype, "questionId", void 0);
__decorate([
    Column(DataType.STRING(64)),
    __metadata("design:type", String)
], GuaribasQuestion.prototype, "subject1", void 0);
__decorate([
    Column(DataType.STRING(64)),
    __metadata("design:type", String)
], GuaribasQuestion.prototype, "subject2", void 0);
__decorate([
    Column(DataType.STRING(64)),
    __metadata("design:type", String)
], GuaribasQuestion.prototype, "subject3", void 0);
__decorate([
    Column(DataType.STRING(64)),
    __metadata("design:type", String)
], GuaribasQuestion.prototype, "subject4", void 0);
__decorate([
    Column(DataType.STRING(1024)),
    __metadata("design:type", String)
], GuaribasQuestion.prototype, "keywords", void 0);
__decorate([
    Column(DataType.BOOLEAN),
    __metadata("design:type", Boolean)
], GuaribasQuestion.prototype, "skipIndex", void 0);
__decorate([
    Column(DataType.STRING(512)),
    __metadata("design:type", String)
], GuaribasQuestion.prototype, "from", void 0);
__decorate([
    Column(DataType.STRING(512)),
    __metadata("design:type", String)
], GuaribasQuestion.prototype, "to", void 0);
__decorate([
    Column(DataType.TEXT),
    __metadata("design:type", String)
], GuaribasQuestion.prototype, "content", void 0);
__decorate([
    Column(DataType.DATE),
    CreatedAt,
    __metadata("design:type", Date)
], GuaribasQuestion.prototype, "createdAt", void 0);
__decorate([
    Column(DataType.DATE),
    UpdatedAt,
    __metadata("design:type", Date)
], GuaribasQuestion.prototype, "updatedAt", void 0);
__decorate([
    ForeignKey(() => GuaribasAnswer),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasQuestion.prototype, "answerId", void 0);
__decorate([
    BelongsTo(() => GuaribasInstance),
    __metadata("design:type", GuaribasInstance)
], GuaribasQuestion.prototype, "instance", void 0);
__decorate([
    ForeignKey(() => GuaribasInstance),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasQuestion.prototype, "instanceId", void 0);
__decorate([
    ForeignKey(() => GuaribasPackage),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasQuestion.prototype, "packageId", void 0);
__decorate([
    BelongsTo(() => GuaribasPackage),
    __metadata("design:type", GuaribasPackage)
], GuaribasQuestion.prototype, "package", void 0);
GuaribasQuestion = __decorate([
    Table
], GuaribasQuestion);
export { GuaribasQuestion };
/**
 * An answer and its metadata.
 */
let GuaribasAnswer = class GuaribasAnswer extends Model {
};
__decorate([
    PrimaryKey,
    AutoIncrement,
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasAnswer.prototype, "answerId", void 0);
__decorate([
    Length({ min: 0, max: 512 }),
    Column(DataType.STRING(512)),
    __metadata("design:type", String)
], GuaribasAnswer.prototype, "media", void 0);
__decorate([
    Length({ min: 0, max: 12 }),
    Column(DataType.STRING(12)),
    __metadata("design:type", String)
], GuaribasAnswer.prototype, "format", void 0);
__decorate([
    Column(DataType.TEXT),
    __metadata("design:type", String)
], GuaribasAnswer.prototype, "content", void 0);
__decorate([
    Column(DataType.DATE),
    CreatedAt,
    __metadata("design:type", Date)
], GuaribasAnswer.prototype, "createdAt", void 0);
__decorate([
    Column(DataType.DATE),
    UpdatedAt,
    __metadata("design:type", Date)
], GuaribasAnswer.prototype, "updatedAt", void 0);
__decorate([
    HasMany(() => GuaribasQuestion),
    __metadata("design:type", Array)
], GuaribasAnswer.prototype, "questions", void 0);
__decorate([
    HasOne(() => GuaribasQuestion),
    __metadata("design:type", GuaribasQuestion)
], GuaribasAnswer.prototype, "prev", void 0);
__decorate([
    HasOne(() => GuaribasQuestion),
    __metadata("design:type", GuaribasQuestion)
], GuaribasAnswer.prototype, "next", void 0);
__decorate([
    ForeignKey(() => GuaribasQuestion),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasAnswer.prototype, "nextId", void 0);
__decorate([
    ForeignKey(() => GuaribasQuestion),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasAnswer.prototype, "prevId", void 0);
__decorate([
    ForeignKey(() => GuaribasInstance),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasAnswer.prototype, "instanceId", void 0);
__decorate([
    ForeignKey(() => GuaribasPackage),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasAnswer.prototype, "packageId", void 0);
__decorate([
    BelongsTo(() => GuaribasPackage),
    __metadata("design:type", GuaribasPackage)
], GuaribasAnswer.prototype, "package", void 0);
GuaribasAnswer = __decorate([
    Table
], GuaribasAnswer);
export { GuaribasAnswer };
//# sourceMappingURL=index.js.map