import { pgTable, text, timestamp, integer } from "drizzle-orm/pg-core";
import { nostrIdentities } from "./nostr-identities";

export const freeTierGrants = pgTable("free_tier_grants", {
  id: text("id").primaryKey(),
  pubkey: text("pubkey").notNull().references(() => nostrIdentities.pubkey),
  requestHash: text("request_hash").notNull(),
  satsAbsorbed: integer("sats_absorbed").notNull(),
  poolBalanceAfter: integer("pool_balance_after").notNull(),
  createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
});

export type FreeTierGrant = typeof freeTierGrants.$inferSelect;
