"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 Port_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Port = exports.PortStatusArr = void 0;
const lib_1 = require("taon/lib");
const lib_2 = require("taon-typeorm/lib");
const lib_3 = require("tnp-core/lib");
exports.PortStatusArr = [
    'unassigned',
    'assigned',
    'assigned-not-registered',
    'assigned-taken-by-os',
];
let Port = Port_1 = class Port extends lib_1.TaonBaseEntity {
    static from(opt) {
        return lib_3._.merge(new Port_1(), opt);
    }
    static getTitleForFreePort(port) {
        return `free port ${port}`;
    }
    get titleOnList() {
        //#region @backendFunc
        return `- ${this.port} <${lib_3.chalk.gray(this.serviceId)}>`;
        //#endregion
    }
    //#region port entity / columns / port
    //#region @websql
    //#endregion
    port;
    //#endregion
    //#region port entity / columns /  serviceId
    //#region @websql
    //#endregion
    serviceId;
    //#endregion
    //#region port entity / columns / status
    /**
     * Port status
     */
    //#region @websql
    //#endregion
    status;
    //#endregion
    //#region port entity / columns / when assigned timestamp
    /**
     * When port was assigned as registered service
     */
    //#region @websql
    //#endregion
    whenAssignedTimestamp;
};
exports.Port = Port;
__decorate([
    (0, lib_2.PrimaryColumn)({
        type: 'int',
        unique: true,
    })
    //#endregion
    ,
    __metadata("design:type", Number)
], Port.prototype, "port", void 0);
__decorate([
    (0, lib_1.CustomColumn)({
        type: 'varchar',
        length: 1000,
        unique: true,
    })
    //#endregion
    ,
    __metadata("design:type", String)
], Port.prototype, "serviceId", void 0);
__decorate([
    (0, lib_1.String500Column)('unassigned')
    //#endregion
    ,
    __metadata("design:type", String)
], Port.prototype, "status", void 0);
__decorate([
    (0, lib_1.NumberColumn)()
    //#endregion
    ,
    __metadata("design:type", Number)
], Port.prototype, "whenAssignedTimestamp", void 0);
exports.Port = Port = Port_1 = __decorate([
    (0, lib_1.TaonEntity)({
        className: 'Port',
        uniqueKeyProp: 'port',
    })
], Port);
//# sourceMappingURL=ports.entity.js.map