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

export const guilds = sqliteTable("guilds", {
  id: integer("id").primaryKey(),
  name: text("name"),
});
export type Guild = typeof guilds.$inferSelect;
export type InsertGuild = typeof guilds.$inferInsert;

export const users = sqliteTable("users", {
  id: integer("id").primaryKey(),
  name: text("name"),
  opt_out: integer("opt_out"),
});
export type User = typeof users.$inferSelect;
export type InsertUser = typeof users.$inferInsert;

export const messages = sqliteTable("messages", {
  id: integer("id").primaryKey(),
  content: text("content"),
  user_id: integer("user_id").references(() => users.id),
  guild_id: integer("guild_id").references(() => guilds.id),
});
export type Message = typeof messages.$inferSelect;
export type InsertMessage = typeof messages.$inferInsert;