import * as fs from "fs";
import { logInfo, logDebug, logError } from "./logger";

export function loadCookiesFromFile(filePath: string): Record<string, string> {
    logInfo(`Loading cookies from ${filePath}`);
    try {
        const content = fs.readFileSync(filePath, "utf8");
        const cookies = JSON.parse(content);
        logDebug("Cookies loaded successfully");
        return cookies;
    } catch (error) {
        logError(`Failed to load cookies from ${filePath}`, error);
        throw error;
    }
}
