"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.NotificationSchema = exports.Notification = void 0;
const mongoose_1 = require("@nestjs/mongoose");
const base_entity_1 = require("../../common/entities/base.entity");
let Notification = class Notification extends base_entity_1.BaseEntity {
    subject;
    message;
    type;
    recipients;
    status;
    sentBy;
    academicYearId;
    classId;
    sectionId;
    fileUrl;
    fileName;
    fileType;
    fileSize;
    channels;
    readBy;
    dismissedBy;
};
exports.Notification = Notification;
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], Notification.prototype, "subject", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], Notification.prototype, "message", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, enum: ['email', 'web'] }),
    __metadata("design:type", String)
], Notification.prototype, "type", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: [String], default: [] }),
    __metadata("design:type", Array)
], Notification.prototype, "recipients", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, enum: ['pending', 'sent', 'failed'], default: 'pending' }),
    __metadata("design:type", String)
], Notification.prototype, "status", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], Notification.prototype, "sentBy", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Notification.prototype, "academicYearId", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Notification.prototype, "classId", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Notification.prototype, "sectionId", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Notification.prototype, "fileUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Notification.prototype, "fileName", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Notification.prototype, "fileType", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", Number)
], Notification.prototype, "fileSize", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: [String], default: ['web'] }),
    __metadata("design:type", Array)
], Notification.prototype, "channels", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: [String], default: [] }),
    __metadata("design:type", Array)
], Notification.prototype, "readBy", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: [String], default: [] }),
    __metadata("design:type", Array)
], Notification.prototype, "dismissedBy", void 0);
exports.Notification = Notification = __decorate([
    (0, mongoose_1.Schema)({ timestamps: true })
], Notification);
exports.NotificationSchema = mongoose_1.SchemaFactory.createForClass(Notification);
exports.NotificationSchema.virtual('id').get(function () {
    return this._id?.toString?.() ?? String(this._id);
});
exports.NotificationSchema.index({ createdAt: -1 });
exports.NotificationSchema.index({ updatedAt: -1 });
exports.NotificationSchema.index({ type: 1, status: 1 });
exports.NotificationSchema.index({ academicYearId: 1, classId: 1, sectionId: 1 });
exports.NotificationSchema.index({ fileUrl: 1 });
exports.NotificationSchema.index({ subject: 'text', message: 'text' });
exports.NotificationSchema.index({ readBy: 1 });
exports.NotificationSchema.index({ dismissedBy: 1 });
const jsonOpts = { versionKey: false, virtuals: true };
exports.NotificationSchema.set('toJSON', jsonOpts);
exports.NotificationSchema.set('toObject', jsonOpts);
//# sourceMappingURL=notification.schema.js.map