import "dotenv/config";
import { createClient } from "@supabase/supabase-js";
const supabase = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, "sb_secret_N7UND0UgjKTVK-Uodkm0Hg_xSvEMPvz");

async function main() {
    // 1. Get student 1 ID
    const { data: students } = await supabase.from("Student").select("id").limit(1);
    const studentId = students?.[0]?.id;
    console.log("Student ID:", studentId);

    // 2. Execute SQL to simulate RLS
    const { data, error } = await supabase.rpc("simulate_rls_query", {
        jwt_claims: JSON.stringify({ sub: studentId, role: "student" }),
        query_table: "Lesson"
    });
    console.log("RPC Error:", error);
    // Wait, rpc might not exist. Let's just create a quick migration or do it directly.
}
main();
