import { machineCheck } from "../../sqlServer/querys/ocp/machineId.js";
import { createLog } from "../../logger/logger.js";
import { query } from "../../sqlServer/prodSqlServer.js";

export const getMac = async (machine: string) => {
    let updateQuery = machineCheck.replaceAll("[loc]", machine);

    // create blank lots in case there is an error and dose not work
    let mac = [];

    try {
        const getMac: any = await query(updateQuery, "Machine id check");

        mac = getMac.data;
        // console.log("Machine data", mac); // removed due to swr being activated
    } catch (err) {
        createLog(
            "error",
            "lst",
            "ocp",
            `Error with Machine id Check query: ${err}`
        );
    }

    return mac;
};
