import mongoose from 'mongoose'; const vocabularySchema = new mongoose.Schema({ userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true }, wkSubjectId: { type: Number, required: true }, characters: { type: String, required: true }, meanings: { type: [String], default: [] }, readings: [{ reading: String, primary: { type: Boolean, default: false } }], partsOfSpeech: { type: [String], default: [] }, level: { type: Number, required: true }, meaningMnemonic: { type: String, default: '' }, readingMnemonic: { type: String, default: '' }, componentSubjectIds: { type: [Number], default: [] }, pronunciationAudios: [{ url: String, contentType: String, gender: String }], contextSentences: [{ ja: String, en: String }] }); vocabularySchema.index({ userId: 1, wkSubjectId: 1 }, { unique: true }); vocabularySchema.index({ userId: 1, level: 1 }); export const Vocabulary = mongoose.model('Vocabulary', vocabularySchema);