import {
  mysqlTable,
  varchar,
  text,
  timestamp,
  char,
} from 'drizzle-orm/mysql-core';

export const grades = mysqlTable('core_edu_grades', {
  id: char('id', { length: 36 }).notNull().primaryKey(),
  studentId: char('student_id', { length: 36 }).notNull(),
  examId: char('exam_id', { length: 36 }),
  homeworkId: char('homework_id', { length: 36 }),
  score: varchar('score', { length: 10 }).notNull(),
  feedback: text('feedback'),
  gradedBy: char('graded_by', { length: 36 }).notNull(),
  createdAt: timestamp('created_at').notNull().defaultNow(),
  updatedAt: timestamp('updated_at').notNull().defaultNow().onUpdateNow(),
});

export type Grade = typeof grades.$inferSelect;
export type NewGrade = typeof grades.$inferInsert;
