"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.StudentSchema = exports.Student = void 0;
const mongoose_1 = require("@nestjs/mongoose");
const base_entity_1 = require("../../common/entities/base.entity");
const class_transformer_1 = require("class-transformer");
const notification_prefs_schema_1 = require("../../common/schemas/notification-prefs.schema");
let ParentInfo = class ParentInfo {
    name;
    email;
    occupation;
    monthlyIncome;
    phone;
    whatsapp;
};
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], ParentInfo.prototype, "name", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true, lowercase: true }),
    __metadata("design:type", String)
], ParentInfo.prototype, "email", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], ParentInfo.prototype, "occupation", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], ParentInfo.prototype, "monthlyIncome", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], ParentInfo.prototype, "phone", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], ParentInfo.prototype, "whatsapp", void 0);
ParentInfo = __decorate([
    (0, mongoose_1.Schema)({ _id: false })
], ParentInfo);
const ParentInfoSchema = mongoose_1.SchemaFactory.createForClass(ParentInfo);
let Documents = class Documents {
    photoUrl;
    fatherPhotoUrl;
    motherPhotoUrl;
    birthCertificateUrl;
    scstCertificateUrl;
    leavingCertificateUrl;
    vaccineCardUrl;
};
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Documents.prototype, "photoUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Documents.prototype, "fatherPhotoUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Documents.prototype, "motherPhotoUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Documents.prototype, "birthCertificateUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Documents.prototype, "scstCertificateUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Documents.prototype, "leavingCertificateUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Documents.prototype, "vaccineCardUrl", void 0);
Documents = __decorate([
    (0, mongoose_1.Schema)({ _id: false })
], Documents);
const DocumentsSchema = mongoose_1.SchemaFactory.createForClass(Documents);
let CustomDocument = class CustomDocument {
    title;
    publishedBy;
    documentUrl;
    uploadDate;
};
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], CustomDocument.prototype, "title", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], CustomDocument.prototype, "publishedBy", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], CustomDocument.prototype, "documentUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: Date, default: Date.now }),
    __metadata("design:type", Date)
], CustomDocument.prototype, "uploadDate", void 0);
CustomDocument = __decorate([
    (0, mongoose_1.Schema)({ _id: false })
], CustomDocument);
const CustomDocumentSchema = mongoose_1.SchemaFactory.createForClass(CustomDocument);
let CustomImage = class CustomImage {
    title;
    imageUrl;
    uploadDate;
};
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], CustomImage.prototype, "title", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], CustomImage.prototype, "imageUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: Date, default: Date.now }),
    __metadata("design:type", Date)
], CustomImage.prototype, "uploadDate", void 0);
CustomImage = __decorate([
    (0, mongoose_1.Schema)({ _id: false })
], CustomImage);
const CustomImageSchema = mongoose_1.SchemaFactory.createForClass(CustomImage);
let EducationEntry = class EducationEntry {
    degree;
    institution;
    startDate;
    endDate;
    grade;
};
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], EducationEntry.prototype, "degree", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], EducationEntry.prototype, "institution", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: Date, required: true }),
    __metadata("design:type", Date)
], EducationEntry.prototype, "startDate", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: Date }),
    __metadata("design:type", Date)
], EducationEntry.prototype, "endDate", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], EducationEntry.prototype, "grade", void 0);
EducationEntry = __decorate([
    (0, mongoose_1.Schema)({ _id: false })
], EducationEntry);
const EducationEntrySchema = mongoose_1.SchemaFactory.createForClass(EducationEntry);
let Student = class Student extends base_entity_1.BaseEntity {
    name;
    uniqueId;
    rollNumber;
    email;
    password;
    role;
    classId;
    sectionId;
    academicYearId;
    gender;
    dateOfBirth;
    admissionDate;
    motherTongue;
    religion;
    caste;
    mediumOfInstruction;
    nationality;
    previousSchoolName;
    tcIssued;
    clearedAllDues;
    tcNumber;
    bloodGroup;
    heightCm;
    weightKg;
    medicalConditions;
    hasAllergies;
    allergyDetails;
    emergencyMedicalInstructions;
    guardianName;
    guardianRelation;
    phone;
    whatsapp;
    address;
    transportRequired;
    routePickupPoint;
    isActive;
    leavingDate;
    leavingReason;
    father;
    mother;
    documents;
    customDocuments;
    customImages;
    education;
    profileImageUrl;
    notificationPrefs;
};
exports.Student = Student;
__decorate([
    (0, mongoose_1.Prop)({ required: true, trim: true }),
    __metadata("design:type", String)
], Student.prototype, "name", void 0);
__decorate([
    (0, mongoose_1.Prop)({ unique: true, sparse: true, trim: true }),
    __metadata("design:type", String)
], Student.prototype, "uniqueId", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, trim: true }),
    __metadata("design:type", String)
], Student.prototype, "rollNumber", void 0);
__decorate([
    (0, mongoose_1.Prop)({ unique: true, sparse: true, trim: true, lowercase: true }),
    __metadata("design:type", String)
], Student.prototype, "email", void 0);
__decorate([
    (0, class_transformer_1.Exclude)(),
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "password", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: 'student' }),
    __metadata("design:type", String)
], Student.prototype, "role", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "classId", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "sectionId", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "academicYearId", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "gender", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", Date)
], Student.prototype, "dateOfBirth", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: Date }),
    __metadata("design:type", Date)
], Student.prototype, "admissionDate", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "motherTongue", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "religion", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "caste", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "mediumOfInstruction", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "nationality", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "previousSchoolName", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: false }),
    __metadata("design:type", Boolean)
], Student.prototype, "tcIssued", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: true }),
    __metadata("design:type", Boolean)
], Student.prototype, "clearedAllDues", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "tcNumber", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "bloodGroup", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "heightCm", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "weightKg", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "medicalConditions", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: false }),
    __metadata("design:type", Boolean)
], Student.prototype, "hasAllergies", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "allergyDetails", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "emergencyMedicalInstructions", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "guardianName", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "guardianRelation", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "phone", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "whatsapp", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], Student.prototype, "address", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: false }),
    __metadata("design:type", Boolean)
], Student.prototype, "transportRequired", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "routePickupPoint", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: true, index: true }),
    __metadata("design:type", Boolean)
], Student.prototype, "isActive", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: Date }),
    __metadata("design:type", Date)
], Student.prototype, "leavingDate", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "leavingReason", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: ParentInfoSchema }),
    __metadata("design:type", ParentInfo)
], Student.prototype, "father", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: ParentInfoSchema }),
    __metadata("design:type", ParentInfo)
], Student.prototype, "mother", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: DocumentsSchema }),
    __metadata("design:type", Documents)
], Student.prototype, "documents", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: [CustomDocumentSchema], default: [] }),
    __metadata("design:type", Array)
], Student.prototype, "customDocuments", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: [CustomImageSchema], default: [] }),
    __metadata("design:type", Array)
], Student.prototype, "customImages", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: [EducationEntrySchema], default: [] }),
    __metadata("design:type", Array)
], Student.prototype, "education", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], Student.prototype, "profileImageUrl", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: notification_prefs_schema_1.NotificationPrefsSchema, default: () => ({ email: true, whatsapp: true }) }),
    __metadata("design:type", notification_prefs_schema_1.NotificationPrefs)
], Student.prototype, "notificationPrefs", void 0);
exports.Student = Student = __decorate([
    (0, mongoose_1.Schema)({ timestamps: true })
], Student);
exports.StudentSchema = mongoose_1.SchemaFactory.createForClass(Student);
exports.StudentSchema.index({ classId: 1 });
exports.StudentSchema.index({ sectionId: 1 });
exports.StudentSchema.index({ academicYearId: 1 });
exports.StudentSchema.index({ academicYearId: 1, classId: 1, sectionId: 1, rollNumber: 1 }, { unique: true, sparse: true });
exports.StudentSchema.set('toJSON', { versionKey: false });
exports.StudentSchema.set('toObject', { versionKey: false });
//# sourceMappingURL=student.schema.js.map