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

const ConsentLog = defineTable({
  columns: {
    id: column.number({ primaryKey: true }),
    sessionId: column.text({ unique: true }),
    timestamp: column.text(),
    locale: column.text({ default: 'th' }),
    essential: column.boolean({ default: true }),
    analytics: column.boolean({ default: false }),
    marketing: column.boolean({ default: false }),
    policyVersion: column.text({ default: '1.0' }),
    ipHash: column.text(),
    userAgent: column.text()
  }
});

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