import { FastifyRequest } from 'fastify'
import { Context } from './types/context'
import { getDb } from './db'
import { TenantContext } from './middleware/tenant-auth'

export async function createContext(request: FastifyRequest): Promise<Context> {
  return {
    request,
    user: (request as any).user, // Set by auth middleware
    tenantContext: (request as any).tenantContext, // Set by tenant auth middleware
    db: getDb(),
  }
}

