import { defineDb, defineTable, column } from 'astro:db';

const ConsentLog = defineTable({
  columns: {
    id: column.number({ primaryKey: true }),
    action: column.text(),
    purpose: column.text(),
    analytics: column.boolean({ default: false }),
    marketing: column.boolean({ default: false }),
    functional: column.boolean({ default: false }),
    userAgent: column.text({ optional: true }),
    ip: column.text({ optional: true }),
    timestamp: column.date(),
    sessionId: column.text({ optional: true }),
  },
});

export default defineDb({
  tables: {
    ConsentLog,
  },
});