import { pgTable, serial, text, timestamp, numeric, integer, uuid, jsonb } from 'drizzle-orm/pg-core'; export const trips = pgTable('trips', { id: uuid('id').primaryKey().defaultRandom(), destination: text('destination').notNull(), lat: numeric('lat'), lng: numeric('lng'), startDate: timestamp('start_date', { withTimezone: true }), numDays: integer('num_days').notNull(), totalBudget: numeric('total_budget'), currency: text('currency').default('EUR'), preferences: jsonb('preferences').$type().default([]), experienceMode: text('experience_mode').default('balanced'), estimatedTotalCost: numeric('estimated_total_cost'), createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(), }); export const activities = pgTable('activities', { id: serial('id').primaryKey(), tripId: uuid('trip_id').references(() => trips.id, { onDelete: 'cascade' }), dayNumber: integer('day_number').notNull(), startTime: text('start_time'), title: text('title').notNull(), type: text('type').notNull(), // attraction | restaurant | bar | event | meal | other estimatedCost: numeric('estimated_cost'), address: text('address'), lat: numeric('lat'), lng: numeric('lng'), rating: numeric('rating'), source: text('source'), sourceUrl: text('source_url'), notes: text('notes'), orderInDay: integer('order_in_day').default(0), }); export type Trip = typeof trips.$inferSelect; export type NewTrip = typeof trips.$inferInsert; export type Activity = typeof activities.$inferSelect; export type NewActivity = typeof activities.$inferInsert;