// /pages/api/cpl/getDigitalOutputsHandler.ts

import { NextApiRequest, NextApiResponse } from "next";
import path from "path";
import fs from "fs/promises";

export default async function handler(
  req: NextApiRequest,
  res: NextApiResponse
) {
  // Lese JSON-Datei z.B. digitalOutputsMockData.json
  const filePath = path.join(
    process.cwd(),
    "mocks/device-cgi-simulator/SERVICE/digitalOutputsMockData.json"
  );
  const content = await fs.readFile(filePath, "utf-8");
  const data = JSON.parse(content);
  return res.status(200).json(data);
}
