import { addHTTPMiddleware } from '@pikku/core/http'
import { cors } from '@pikku/core/middleware'

// The Better Auth session-bridge middleware (betterAuthSession) is generated and
// registered globally by the pikku CLI from src/wirings/auth.ts — see
// src/scaffold/auth.gen.ts — so it is NOT wired here. This file only configures
// CORS for the browser client.
addHTTPMiddleware('*', [
  cors({
    origin: true,
    credentials: true,
    headers: ['Content-Type', 'Authorization', 'X-Auth-Return-Redirect'],
  }),
])
