import express from "express";

const app = express();

app.get("/api/today", (req, res) => {
  const userLink = req.query.userLink;

  // Simulate fetching today's schedule
  const todaySchedule = {
    subjects: [
      {
        lesson_nr: "1.",
        name: "D G2",
        room: "255",
        teacher: "VanC",
        clock: "08:00-08:55",
        cancelled: false,
      },
      {
        lesson_nr: "2. & 3.",
        name: "M G2",
        room: "255",
        teacher: "ScLa",
        clock: "08:55-10:25",
        cancelled: false,
      },
      {
        lesson_nr: "4.",
        name: "E G4",
        room: "254",
        teacher: "RadF",
        clock: "10:55-11:40",
        cancelled: false,
      },
      {
        lesson_nr: "5.",
        name: "CH G2",
        room: "133",
        teacher: "LenT",
        clock: "11:40-12:25",
        cancelled: true,
      },
    ],
    date: "15.04.2026",
    day: "Mittwoch",
    week: "16",
    student: "Max Mustermann",
  };

  console.log(`Fetching schedule for user: ${userLink}`);
  res.json(todaySchedule);
});

app.listen(8001, () => {
  console.log("Server is running on port 8001");
});
