"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.WifiSession = exports.WifiSessionStatus = void 0;
const typeorm_1 = require("typeorm");
const customer_entity_1 = require("./customer.entity");
const package_entity_1 = require("./package.entity");
const router_entity_1 = require("./router.entity");
const business_entity_1 = require("./business.entity");
const customer_device_entity_1 = require("./customer-device.entity");
var WifiSessionStatus;
(function (WifiSessionStatus) {
    WifiSessionStatus["PENDING_ACTIVATION"] = "PENDING_ACTIVATION";
    WifiSessionStatus["ACTIVE"] = "ACTIVE";
    WifiSessionStatus["PAUSED"] = "PAUSED";
    WifiSessionStatus["EXPIRED"] = "EXPIRED";
    WifiSessionStatus["DATA_EXHAUSTED"] = "DATA_EXHAUSTED";
    WifiSessionStatus["DISCONNECTED"] = "DISCONNECTED";
    WifiSessionStatus["CANCELLED"] = "CANCELLED";
    WifiSessionStatus["ACTIVATION_FAILED"] = "ACTIVATION_FAILED";
})(WifiSessionStatus || (exports.WifiSessionStatus = WifiSessionStatus = {}));
let WifiSession = class WifiSession {
};
exports.WifiSession = WifiSession;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], WifiSession.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    __metadata("design:type", String)
], WifiSession.prototype, "customerId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    __metadata("design:type", String)
], WifiSession.prototype, "packageId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    __metadata("design:type", String)
], WifiSession.prototype, "routerId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    __metadata("design:type", String)
], WifiSession.prototype, "businessId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], WifiSession.prototype, "deviceId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'enum', enum: WifiSessionStatus, default: WifiSessionStatus.PENDING_ACTIVATION }),
    __metadata("design:type", String)
], WifiSession.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
    __metadata("design:type", Date)
], WifiSession.prototype, "startTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
    __metadata("design:type", Date)
], WifiSession.prototype, "endTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
    __metadata("design:type", Date)
], WifiSession.prototype, "expiryTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'bigint', nullable: true }),
    __metadata("design:type", Number)
], WifiSession.prototype, "remainingDataMb", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'decimal', precision: 12, scale: 2, default: 0 }),
    __metadata("design:type", Number)
], WifiSession.prototype, "dataUsedMb", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 45, nullable: true }),
    __metadata("design:type", String)
], WifiSession.prototype, "ipAddress", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 17, nullable: true }),
    __metadata("design:type", String)
], WifiSession.prototype, "macAddress", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
    __metadata("design:type", String)
], WifiSession.prototype, "sessionKey", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
    __metadata("design:type", String)
], WifiSession.prototype, "routerSessionId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'int', default: 0 }),
    __metadata("design:type", Number)
], WifiSession.prototype, "activationAttempts", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", String)
], WifiSession.prototype, "lastActivationError", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
    __metadata("design:type", Date)
], WifiSession.prototype, "disconnectedAt", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
    __metadata("design:type", Date)
], WifiSession.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({ type: 'timestamp' }),
    __metadata("design:type", Date)
], WifiSession.prototype, "updatedAt", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => customer_entity_1.Customer),
    (0, typeorm_1.JoinColumn)({ name: 'customerId' }),
    __metadata("design:type", customer_entity_1.Customer)
], WifiSession.prototype, "customer", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => package_entity_1.Package),
    (0, typeorm_1.JoinColumn)({ name: 'packageId' }),
    __metadata("design:type", package_entity_1.Package)
], WifiSession.prototype, "package", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => router_entity_1.Router),
    (0, typeorm_1.JoinColumn)({ name: 'routerId' }),
    __metadata("design:type", router_entity_1.Router)
], WifiSession.prototype, "router", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => business_entity_1.Business),
    (0, typeorm_1.JoinColumn)({ name: 'businessId' }),
    __metadata("design:type", business_entity_1.Business)
], WifiSession.prototype, "business", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => customer_device_entity_1.CustomerDevice, { nullable: true }),
    (0, typeorm_1.JoinColumn)({ name: 'deviceId' }),
    __metadata("design:type", customer_device_entity_1.CustomerDevice)
], WifiSession.prototype, "device", void 0);
exports.WifiSession = WifiSession = __decorate([
    (0, typeorm_1.Entity)('wifi_sessions'),
    (0, typeorm_1.Index)(['customerId']),
    (0, typeorm_1.Index)(['routerId']),
    (0, typeorm_1.Index)(['businessId']),
    (0, typeorm_1.Index)(['status'])
], WifiSession);
