import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';

const AUTH_COOKIE = 'libnovel_auth';

/**
 * POST /api/auth/logout
 * Clears the auth cookie and returns { ok: true }.
 * Does not revoke the session record from PocketBase —
 * for full revocation use DELETE /api/sessions/[id] first.
 */
export const POST: RequestHandler = async ({ cookies }) => {
	cookies.delete(AUTH_COOKIE, { path: '/' });
	return json({ ok: true });
};
