import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';

class VocabCourseEnrollment extends Model {}

VocabCourseEnrollment.init({
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
    userId: {
        type: DataTypes.INTEGER,
        allowNull: false,
        field: 'user_id'
    },
    courseId: {
        type: DataTypes.INTEGER,
        allowNull: false,
        field: 'course_id'
    },
    enrolledAt: {
        type: DataTypes.DATE,
        allowNull: false,
        defaultValue: DataTypes.NOW,
        field: 'enrolled_at'
    }
}, {
    sequelize,
    modelName: 'VocabCourseEnrollment',
    tableName: 'vocab_course_enrollment',
    schema: 'community',
    timestamps: false,
    underscored: true
});

export default VocabCourseEnrollment;
