import { createLog } from "../../../../logger/logger.js";

export const scacCheck = async (data: any) => {
    createLog(
        "info",
        "ti",
        "notify",
        `Checking if ${data[0].addressAlias} has scac: ${
            data[0].remark.split(",")[0] ? "there was one" : "no scac"
        }`
    );

    const priceSheet = `
        <PriceSheets>
            <PriceSheet type="Carrier" isSelected="${
                data[0].remark.split(",")[0] ? "true" : "false"
            }">
                <ContractId/>
                ${
                    data[0].remark.split(",")[0]
                        ? `<SCAC>${data[0].remark
                              .split(",")[0]
                              .split(":")[1]
                              .toUpperCase()}</SCAC>`
                        : `<SCAC/>`
                }
                <Mode/>
        </PriceSheet>
        </PriceSheets>
        `;

    return priceSheet;
};
