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

export const questions = mysqlTable("content_questions", {
  id: char("id", { length: 36 }).notNull().primaryKey(),
  knowledgePointId: char("knowledge_point_id", { length: 36 }).notNull(),
  type: varchar("type", { length: 50 }).notNull(),
  content: text("content").notNull(),
  answer: text("answer"),
  explanation: text("explanation"),
  difficulty: int("difficulty").default(3),
  createdAt: timestamp("created_at").notNull().defaultNow(),
  updatedAt: timestamp("updated_at").notNull().defaultNow().onUpdateNow(),
});

export type Question = typeof questions.$inferSelect;
export type NewQuestion = typeof questions.$inferInsert;
