const { DataTypes } = require("sequelize");
const sequelize = require("../db");

const TrainingLessonProgress = sequelize.define("TrainingLessonProgress", {
  watchProgressPercent: {
    type: DataTypes.FLOAT,
    defaultValue: 0,
    comment: "Watch progress 0-100",
  },
  completed: {
    type: DataTypes.BOOLEAN,
    defaultValue: false,
    comment: "Watched >= watchUnlockPercent",
  },
  lastWatchedAt: {
    type: DataTypes.DATE,
  },
  // UserId and TrainingLessonId added via associations
}, {
  freezeTableName: true,
  tableName: 'TrainingLessonProgress'
});

module.exports = TrainingLessonProgress;
