import { pgTable, text, timestamp } from "drizzle-orm/pg-core";

// Dedup log for inbound Stripe webhook events. Stripe may redeliver the same
// event within its retry/tolerance window; we insert the event id here
// before processing and skip processing entirely if the insert hits the
// primary key conflict (i.e. we've already handled this event).
export const processedStripeEvents = pgTable("processed_stripe_events", {
  id: text("id").primaryKey(), // Stripe event id, e.g. "evt_..."
  type: text("type").notNull(),
  createdAt: timestamp("created_at").notNull().defaultNow(),
});
