import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
import { users } from "./users";

export const npsResponses = sqliteTable("nps_responses", {
  id: integer("id").primaryKey({ autoIncrement: true }),
  userId: integer("user_id").references(() => users.id),
  score: integer("score").notNull(),
  category: text("category", { enum: ["detractor", "passive", "promoter"] }).notNull(),
  feedback: text("feedback"),
  surveyId: text("survey_id"),
  respondentEmail: text("respondent_email"),
  createdAt: integer("created_at", { mode: "timestamp" }).notNull().default(new Date()),
});

export type NPSResponse = typeof npsResponses.$inferSelect;
export type NewNPSResponse = typeof npsResponses.$inferInsert;
