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

export const homework = mysqlTable('core_edu_homework', {
  id: char('id', { length: 36 }).notNull().primaryKey(),
  classId: char('class_id', { length: 36 }).notNull(),
  title: varchar('title', { length: 200 }).notNull(),
  description: text('description'),
  dueDate: datetime('due_date').notNull(),
  status: varchar('status', { length: 20 }).notNull().default('assigned'),
  createdBy: char('created_by', { length: 36 }).notNull(),
  createdAt: timestamp('created_at').notNull().defaultNow(),
  updatedAt: timestamp('updated_at').notNull().defaultNow().onUpdateNow(),
});

export type Homework = typeof homework.$inferSelect;
export type NewHomework = typeof homework.$inferInsert;
