import { NextResponse } from "next/server";
import { prisma } from "@/lib/db";
import { getSession } from "@/lib/auth";

export async function GET() {
  const session = await getSession();
  if (!session) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });

  const templates = await prisma.reminderTemplate.findMany({
    where: { clinicId: session.id },
    orderBy: { sortOrder: "asc" },
  });

  return NextResponse.json(templates);
}
