import { Router } from "express";
import { apiReturn } from "../utils/returnHelper.utils.js";
import { stopTCPServer } from "./tcp.server.js";

const r = Router();

r.post("/stop", async (_, res) => {
	const connect = await stopTCPServer();
	apiReturn(res, {
		success: connect.success,
		level: connect.success ? "info" : "error",
		module: "routes",
		subModule: "prodSql",
		message: connect.message,
		data: [],
		status: connect.success ? 200 : 400,
	});
});

export default r;
