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

export const classes = mysqlTable('classes', {
  id: char('id', { length: 36 }).notNull().primaryKey(),
  name: varchar('name', { length: 100 }).notNull(),
  gradeId: char('grade_id', { length: 36 }).notNull(),
  headTeacherId: char('head_teacher_id', { length: 36 }),
  description: text('description'),
  createdAt: timestamp('created_at').notNull().defaultNow(),
  updatedAt: timestamp('updated_at').notNull().defaultNow().onUpdateNow(),
});

export type Class = typeof classes.$inferSelect;
export type NewClass = typeof classes.$inferInsert;
