const { DataTypes } = require('sequelize'); const { sequelize } = require('../config/database'); const Sentences = sequelize.define('Sentences', { id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true, comment: 'Unique identifier for sentence entry' }, // Từ thực tế (wash, washes, washing, ate, eaten...) text: { type: DataTypes.TEXT, allowNull: false }, ipa : { type: DataTypes.TEXT, comment: 'International Phonetic Alphabet representation' }, // Nội dung dùng chung (có thể lưu JSON để dễ quản lý hoặc dùng chung cho cả group) vi: { type: DataTypes.TEXT, defaultValue: '', comment: 'Vietnamese meaning' }, grade : { type: DataTypes.TEXT, defaultValue: '0', comment: 'Grade level (e.g., Grade 1, Grade 2)' }, category: { type: DataTypes.TEXT, comment: 'Category of the sentence (e.g., Action Verbs, Nouns)' }, topic: { type: DataTypes.TEXT, comment: 'Topic of the sentence (e.g., Food, Travel, Education)' }, image_small: { type: DataTypes.JSON, defaultValue: [], comment: 'Array of image URLs' }, image_square: { type: DataTypes.JSON, defaultValue: [], comment: 'Array of image URLs' }, image_normal: { type: DataTypes.JSON, defaultValue: [], comment: 'Array of image URLs' }, audio : { type: DataTypes.JSON, comment: 'Array of audio URLs' }, tags: { type: DataTypes.JSON, defaultValue: [], comment: 'Array of tags for categorization' }, usage_note: { type: DataTypes.TEXT, defaultValue: '', comment: 'Lưu ý về ngữ cảnh sử dụng câu này' }, etc : { type: DataTypes.TEXT, defaultValue: '', comment: 'Các thông tin khác liên quan đến câu này (ví dụ: level, grammar points, etc.)' }, is_active: { type: DataTypes.BOOLEAN, defaultValue: true, comment: 'Whether this sentence entry is active' }, created_at: { type: DataTypes.DATE, defaultValue: DataTypes.NOW }, updated_at: { type: DataTypes.DATE, defaultValue: DataTypes.NOW } }, { tableName: 'sentences', timestamps: true, createdAt: 'created_at', updatedAt: 'updated_at', indexes: [ { name: 'idx_sentences_text', fields: [{ name: 'text', length: 191 }] }, { name: 'idx_category', fields: [{ name: 'category', length: 191 }] } ] }); module.exports = Sentences;