/*****************************************************************************\
|                                               ( )_  _                       |
|    _ _    _ __   _ _    __    ___ ___     _ _ | ,_)(_)  ___   ___     _     |
|   ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| |  | |/',__)/' 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);
};
import { AutoIncrement, BelongsTo, Column, DataType, ForeignKey, Length, Model, PrimaryKey, Table } from 'sequelize-typescript';
import { GuaribasInstance } from '../../core.gbapp/models/GBModel.js';
/**
 * A user and its metadata.
 */
let GuaribasUser = class GuaribasUser extends Model {
};
__decorate([
    PrimaryKey,
    AutoIncrement,
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasUser.prototype, "userId", void 0);
__decorate([
    Column(DataType.STRING(255)),
    __metadata("design:type", String)
], GuaribasUser.prototype, "displayName", void 0);
__decorate([
    Column(DataType.STRING(255)),
    __metadata("design:type", String)
], GuaribasUser.prototype, "userSystemId", void 0);
__decorate([
    Column(DataType.STRING(255)),
    __metadata("design:type", String)
], GuaribasUser.prototype, "userName", void 0);
__decorate([
    Column(DataType.STRING(255)),
    __metadata("design:type", String)
], GuaribasUser.prototype, "defaultChannel", void 0);
__decorate([
    Column(DataType.STRING(255)),
    __metadata("design:type", String)
], GuaribasUser.prototype, "email", void 0);
__decorate([
    Column(DataType.STRING(5)),
    __metadata("design:type", String)
], GuaribasUser.prototype, "locale", void 0);
__decorate([
    ForeignKey(() => GuaribasInstance),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasUser.prototype, "instanceId", void 0);
__decorate([
    BelongsTo(() => GuaribasInstance),
    __metadata("design:type", GuaribasInstance)
], GuaribasUser.prototype, "instance", void 0);
__decorate([
    Column(DataType.INTEGER),
    __metadata("design:type", String)
], GuaribasUser.prototype, "agentSystemId", void 0);
__decorate([
    Column(DataType.DATE),
    __metadata("design:type", Date)
], GuaribasUser.prototype, "agentContacted", void 0);
__decorate([
    Column(DataType.STRING(16)),
    __metadata("design:type", String)
], GuaribasUser.prototype, "agentMode", void 0);
__decorate([
    Column(DataType.TEXT),
    __metadata("design:type", String)
], GuaribasUser.prototype, "conversationReference", void 0);
__decorate([
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasUser.prototype, "conversationId", void 0);
__decorate([
    Column(DataType.STRING(64)),
    __metadata("design:type", String)
], GuaribasUser.prototype, "hearOnDialog", void 0);
__decorate([
    Column(DataType.STRING(4000)),
    __metadata("design:type", String)
], GuaribasUser.prototype, "params", void 0);
GuaribasUser = __decorate([
    Table
], GuaribasUser);
export { GuaribasUser };
/**
 * A group of users.
 */
let GuaribasGroup = class GuaribasGroup extends Model {
};
__decorate([
    PrimaryKey,
    AutoIncrement,
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasGroup.prototype, "groupId", void 0);
__decorate([
    Length({ min: 0, max: 512 }),
    Column(DataType.STRING(512)),
    __metadata("design:type", String)
], GuaribasGroup.prototype, "displayName", void 0);
__decorate([
    ForeignKey(() => GuaribasInstance),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasGroup.prototype, "instanceId", void 0);
__decorate([
    BelongsTo(() => GuaribasInstance),
    __metadata("design:type", GuaribasInstance)
], GuaribasGroup.prototype, "instance", void 0);
GuaribasGroup = __decorate([
    Table
], GuaribasGroup);
export { GuaribasGroup };
/**
 * Relation of groups and users.
 */
let GuaribasUserGroup = class GuaribasUserGroup extends Model {
};
__decorate([
    ForeignKey(() => GuaribasUser),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasUserGroup.prototype, "userId", void 0);
__decorate([
    ForeignKey(() => GuaribasGroup),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasUserGroup.prototype, "groupId", void 0);
__decorate([
    ForeignKey(() => GuaribasInstance),
    Column(DataType.INTEGER),
    __metadata("design:type", Number)
], GuaribasUserGroup.prototype, "instanceId", void 0);
__decorate([
    BelongsTo(() => GuaribasInstance),
    __metadata("design:type", GuaribasInstance)
], GuaribasUserGroup.prototype, "instance", void 0);
__decorate([
    BelongsTo(() => GuaribasGroup),
    __metadata("design:type", GuaribasGroup)
], GuaribasUserGroup.prototype, "group", void 0);
__decorate([
    BelongsTo(() => GuaribasUser),
    __metadata("design:type", GuaribasUser)
], GuaribasUserGroup.prototype, "user", void 0);
GuaribasUserGroup = __decorate([
    Table
], GuaribasUserGroup);
export { GuaribasUserGroup };
//# sourceMappingURL=index.js.map