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 { ChildEntity, Column, DeleteDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, TableInheritance, } from 'typeorm';
let DeviceOverviewModel = class DeviceOverviewModel {
    uuid;
    name;
    description;
    type;
    isPublic;
    deletedAt;
    additionalAttributes;
};
__decorate([
    PrimaryGeneratedColumn('uuid'),
    __metadata("design:type", String)
], DeviceOverviewModel.prototype, "uuid", void 0);
__decorate([
    Column(),
    __metadata("design:type", String)
], DeviceOverviewModel.prototype, "name", void 0);
__decorate([
    Column({ nullable: true }),
    __metadata("design:type", String)
], DeviceOverviewModel.prototype, "description", void 0);
__decorate([
    Column(),
    __metadata("design:type", String)
], DeviceOverviewModel.prototype, "type", void 0);
__decorate([
    Column('boolean', { default: false }),
    __metadata("design:type", Boolean)
], DeviceOverviewModel.prototype, "isPublic", void 0);
__decorate([
    DeleteDateColumn(),
    __metadata("design:type", Date)
], DeviceOverviewModel.prototype, "deletedAt", void 0);
__decorate([
    Column({ type: 'simple-json' }),
    __metadata("design:type", Object)
], DeviceOverviewModel.prototype, "additionalAttributes", void 0);
DeviceOverviewModel = __decorate([
    Entity({ name: 'Device' }),
    TableInheritance({
        column: {
            type: 'varchar',
            name: 'type',
            enum: ['device', 'group', 'cloud instantiable', 'edge instantiable'],
        },
    })
], DeviceOverviewModel);
export { DeviceOverviewModel };
let InstantiableDeviceOverviewModel = class InstantiableDeviceOverviewModel extends DeviceOverviewModel {
    instances;
};
__decorate([
    OneToMany(() => ConcreteDeviceModel, concreteDevice => concreteDevice.instanceOf, {
        onDelete: 'CASCADE',
        cascade: true,
    }),
    __metadata("design:type", Array)
], InstantiableDeviceOverviewModel.prototype, "instances", void 0);
InstantiableDeviceOverviewModel = __decorate([
    ChildEntity()
], InstantiableDeviceOverviewModel);
export { InstantiableDeviceOverviewModel };
let ConcreteDeviceModel = class ConcreteDeviceModel extends DeviceOverviewModel {
    availabilityRules;
    experiment;
    token;
    services;
    instanceOf;
};
__decorate([
    Column('simple-json'),
    __metadata("design:type", Array)
], ConcreteDeviceModel.prototype, "availabilityRules", void 0);
__decorate([
    Column(),
    __metadata("design:type", String)
], ConcreteDeviceModel.prototype, "experiment", void 0);
__decorate([
    Column(),
    __metadata("design:type", String)
], ConcreteDeviceModel.prototype, "token", void 0);
__decorate([
    Column('simple-json'),
    __metadata("design:type", Array)
], ConcreteDeviceModel.prototype, "services", void 0);
__decorate([
    ManyToOne(() => InstantiableDeviceOverviewModel, instantiableDevice => instantiableDevice.instances),
    __metadata("design:type", InstantiableDeviceOverviewModel)
], ConcreteDeviceModel.prototype, "instanceOf", void 0);
ConcreteDeviceModel = __decorate([
    ChildEntity('device')
], ConcreteDeviceModel);
export { ConcreteDeviceModel };
let DeviceGroupModel = class DeviceGroupModel extends DeviceOverviewModel {
    devices;
};
__decorate([
    Column('simple-json'),
    __metadata("design:type", Array)
], DeviceGroupModel.prototype, "devices", void 0);
DeviceGroupModel = __decorate([
    ChildEntity('group')
], DeviceGroupModel);
export { DeviceGroupModel };
let InstantiableCloudDeviceModel = class InstantiableCloudDeviceModel extends InstantiableDeviceOverviewModel {
    instantiateUrl;
    services;
};
__decorate([
    Column(),
    __metadata("design:type", String)
], InstantiableCloudDeviceModel.prototype, "instantiateUrl", void 0);
__decorate([
    Column('simple-json'),
    __metadata("design:type", Array)
], InstantiableCloudDeviceModel.prototype, "services", void 0);
InstantiableCloudDeviceModel = __decorate([
    ChildEntity('cloud instantiable')
], InstantiableCloudDeviceModel);
export { InstantiableCloudDeviceModel };
let InstantiableBrowserDeviceModel = class InstantiableBrowserDeviceModel extends InstantiableDeviceOverviewModel {
    codeUrl;
    services;
};
__decorate([
    Column(),
    __metadata("design:type", String)
], InstantiableBrowserDeviceModel.prototype, "codeUrl", void 0);
__decorate([
    Column('simple-json'),
    __metadata("design:type", Array)
], InstantiableBrowserDeviceModel.prototype, "services", void 0);
InstantiableBrowserDeviceModel = __decorate([
    ChildEntity('edge instantiable')
], InstantiableBrowserDeviceModel);
export { InstantiableBrowserDeviceModel };
let PeerconnectionModel = class PeerconnectionModel {
    uuid;
    type;
    status;
    deviceA;
    deviceB;
    configuration;
    deletedAt;
};
__decorate([
    PrimaryGeneratedColumn('uuid'),
    __metadata("design:type", String)
], PeerconnectionModel.prototype, "uuid", void 0);
__decorate([
    Column(),
    __metadata("design:type", String)
], PeerconnectionModel.prototype, "type", void 0);
__decorate([
    Column('varchar'),
    __metadata("design:type", String)
], PeerconnectionModel.prototype, "status", void 0);
__decorate([
    Column('simple-json'),
    __metadata("design:type", Object)
], PeerconnectionModel.prototype, "deviceA", void 0);
__decorate([
    Column('simple-json'),
    __metadata("design:type", Object)
], PeerconnectionModel.prototype, "deviceB", void 0);
__decorate([
    Column('simple-json'),
    __metadata("design:type", Object)
], PeerconnectionModel.prototype, "configuration", void 0);
__decorate([
    DeleteDateColumn(),
    __metadata("design:type", Date)
], PeerconnectionModel.prototype, "deletedAt", void 0);
PeerconnectionModel = __decorate([
    Entity({ name: 'Peerconnection' })
], PeerconnectionModel);
export { PeerconnectionModel };
export const Entities = [
    DeviceOverviewModel,
    InstantiableDeviceOverviewModel,
    ConcreteDeviceModel,
    DeviceGroupModel,
    InstantiableCloudDeviceModel,
    InstantiableBrowserDeviceModel,
    PeerconnectionModel,
];
//# sourceMappingURL=model.js.map