// /pages/api/cpl/getAnalogInputsHandler.ts

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

export default function handler(req: NextApiRequest, res: NextApiResponse) {
  try {
    const filePath = path.join(
      process.cwd(),
      "mocks/device-cgi-simulator/SERVICE/analogInputsMockData.json"
    );
    const jsonContent = fs.readFileSync(filePath, "utf-8");
    const data = JSON.parse(jsonContent);
    res.status(200).json(data);
    return;
  } catch (error) {
    console.error(error);
    res.status(500).json({ error: "Internal Server Error" });
  }
}
