import { Model, DataTypes, Sequelize } from 'sequelize'; export interface InterviewEvaluationAttributes { id: string; interviewId: string; evaluatorId: string; ktMatrixScore: number | null; qualitativeFeedback: string | null; recommendation: string | null; } export interface InterviewEvaluationInstance extends Model, InterviewEvaluationAttributes { } export default (sequelize: Sequelize) => { const InterviewEvaluation = sequelize.define('InterviewEvaluation', { id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true }, interviewId: { type: DataTypes.UUID, allowNull: false, references: { model: 'interviews', key: 'id' } }, evaluatorId: { type: DataTypes.UUID, allowNull: false, references: { model: 'users', key: 'id' } }, ktMatrixScore: { type: DataTypes.DECIMAL(10, 2), allowNull: true }, qualitativeFeedback: { type: DataTypes.TEXT, allowNull: true }, recommendation: { type: DataTypes.STRING, allowNull: true } }, { tableName: 'interview_evaluations', timestamps: true }); (InterviewEvaluation as any).associate = (models: any) => { InterviewEvaluation.belongsTo(models.Interview, { foreignKey: 'interviewId', as: 'interview' }); InterviewEvaluation.belongsTo(models.User, { foreignKey: 'evaluatorId', as: 'evaluator' }); InterviewEvaluation.hasMany(models.KTMatrixScore, { foreignKey: 'evaluationId', as: 'criterionScores' }); InterviewEvaluation.hasMany(models.InterviewFeedback, { foreignKey: 'evaluationId', as: 'feedbackDetails' }); }; return InterviewEvaluation; };