// shared/homepage-schema-fragment.ts
// ─── Database Schema for Homepage Content ──────────────────────────────
// This is the ONLY new table needed for the Puck editor system.
// Add this to your existing Drizzle schema file.
//
// If you use a different ORM (Prisma, etc.), create an equivalent table:
//   - id: UUID primary key
//   - site_id: unique VARCHAR (identifies this site)
//   - content: JSONB (stores the entire Puck editor state)
//   - updated_at: TIMESTAMP
//   - updated_by: VARCHAR (nullable)

import { pgTable, uuid, varchar, jsonb, timestamp } from 'drizzle-orm/pg-core';

export const homepageContent = pgTable('homepage_content', {
  id: uuid('id').primaryKey().defaultRandom(),
  siteId: varchar('site_id', { length: 255 }).notNull().unique(),
  content: jsonb('content').notNull().default({}),
  updatedAt: timestamp('updated_at').defaultNow(),
  updatedBy: varchar('updated_by', { length: 255 }),
});

export type HomepageContent = typeof homepageContent.$inferSelect;
export type InsertHomepageContent = typeof homepageContent.$inferInsert;
