import { integer, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";

export const analytics = pgTable("analytics", {
	id: uuid("id").defaultRandom().primaryKey(),

	createdAt: timestamp("created_at", { withTimezone: true })
		.defaultNow()
		.notNull(),

	method: text("method").notNull(),
	routePattern: text("route_pattern").notNull(),
	actualPath: text("actual_path").notNull(),

	statusCode: integer("status_code").notNull(),
	durationMs: integer("duration_ms").notNull(),

	module: text("module"),
	userId: text("user_id"),
	userEmail: text("user_email"),

	ipAddress: text("ip_address"),
	userAgent: text("user_agent"),
});
