import { ordersSchema } from '@platform-modules/commerce-orders'
import { pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'

export const checkoutSession = pgTable('checkout_session', {
  orderId: uuid('order_id').primaryKey(),
  clientSecret: text('client_secret').notNull(),
  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
  updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
})

export const checkoutSchema = {
  checkoutSession,
}

export type CheckoutSchema = typeof checkoutSchema

export const checkoutDbSchema = { ...checkoutSchema, ...ordersSchema }

export type CheckoutDbSchema = typeof checkoutDbSchema
