"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.NotificationQueue = void 0;
const typeorm_1 = require("typeorm");
const notification_entity_1 = require("./notification.entity");
let NotificationQueue = class NotificationQueue {
};
exports.NotificationQueue = NotificationQueue;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], NotificationQueue.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    (0, typeorm_1.Index)(),
    __metadata("design:type", String)
], NotificationQueue.prototype, "notification_id", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => notification_entity_1.Notification, { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'notification_id' }),
    __metadata("design:type", notification_entity_1.Notification)
], NotificationQueue.prototype, "notification", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'enum',
        enum: ['email', 'push', 'in_app', 'sms', 'whatsapp'],
        enumName: 'notifications.channel',
    }),
    __metadata("design:type", String)
], NotificationQueue.prototype, "channel", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamp with time zone', default: () => 'NOW()' }),
    __metadata("design:type", Date)
], NotificationQueue.prototype, "scheduled_for", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'int', default: 0 }),
    (0, typeorm_1.Index)(),
    __metadata("design:type", Number)
], NotificationQueue.prototype, "priority_value", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'int', default: 0 }),
    __metadata("design:type", Number)
], NotificationQueue.prototype, "attempts", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'int', default: 3 }),
    __metadata("design:type", Number)
], NotificationQueue.prototype, "max_attempts", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'enum',
        enum: ['queued', 'processing', 'sent', 'failed', 'retrying'],
        enumName: 'notifications.queue_status',
        default: 'queued',
    }),
    (0, typeorm_1.Index)(),
    __metadata("design:type", String)
], NotificationQueue.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamp with time zone', nullable: true }),
    __metadata("design:type", Object)
], NotificationQueue.prototype, "last_attempt_at", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamp with time zone', nullable: true }),
    (0, typeorm_1.Index)(),
    __metadata("design:type", Object)
], NotificationQueue.prototype, "next_retry_at", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamp with time zone', nullable: true }),
    __metadata("design:type", Object)
], NotificationQueue.prototype, "completed_at", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", Object)
], NotificationQueue.prototype, "error_message", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'int', default: 0 }),
    __metadata("design:type", Number)
], NotificationQueue.prototype, "error_count", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'jsonb', default: {} }),
    __metadata("design:type", Object)
], NotificationQueue.prototype, "metadata", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ type: 'timestamp with time zone' }),
    __metadata("design:type", Date)
], NotificationQueue.prototype, "created_at", void 0);
exports.NotificationQueue = NotificationQueue = __decorate([
    (0, typeorm_1.Entity)({ schema: 'notifications', name: 'notification_queue' })
], NotificationQueue);
//# sourceMappingURL=notification-queue.entity.js.map