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

export const files = pgTable('file', {
  id: uuid('id').primaryKey().defaultRandom(),
  path: varchar('path', { length: 1000 }).notNull(),
  filename: varchar('filename', { length: 255 }).notNull(),
  contentType: varchar('content_type', { length: 100 }).notNull(),
  sizeBytes: integer('size_bytes').notNull(),
  entityType: varchar('entity_type', { length: 100 }).notNull(),
  entityId: uuid('entity_id').notNull(),
  category: varchar('category', { length: 100 }).notNull(),
  uploadedBy: uuid('uploaded_by'),
  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
})

export type FileRecord = typeof files.$inferSelect
export type FileRecordInsert = typeof files.$inferInsert
