/**
 * @fileoverview Common utility functions for compilation, file operations, and error handling.
 * Provides cross-language compilation, test filtering, config reading, and directory management.
 */
import ConfigFile, { LocalChecker, LocalGenerator, LocalSolution, LocalValidator } from '../types';
/** Default compilation timeout in milliseconds */
export declare const DEFAULT_TIMEOUT = 10000;
/** Default memory limit in megabytes */
export declare const DEFAULT_MEMORY_LIMIT = 1024;
export declare const ENV: string;
export declare const SECRET_KEY_LOCATION: string;
export declare const API_KEY_LOCATION: string;
/**
 * Compiles a C++ source file using g++.
 * Uses -O2 optimization and C++23 standard.
 *
 * @param {string} sourcePath - Path to the .cpp source file
 * @returns {Promise<string>} Path to the compiled executable
 *
 * @throws {Error} If file is not .cpp or compilation fails
 *
 * @example
 * const executablePath = await compileCPP('solutions/main.cpp');
 * // Returns: '/path/to/solutions/main'
 */
export declare function compileCPP(sourcePath: string): Promise<void>;
/**
 * Compiles a Java source file using javac.
 *
 * @param {string} sourcePath - Path to the .java source file
 * @returns {Promise<string>} Java execution command (e.g., "java -cp /path ClassName")
 *
 * @throws {Error} If compilation fails
 *
 * @example
 * const javaCommand = await compileJava('solutions/Solution.java');
 * // Returns: 'java -cp /path/to/solutions Solution'
 */
export declare function compileJava(sourcePath: string): Promise<void>;
/**
 * Filters test files by a numerical range.
 * Looks for files named like "test1.txt", "test2.txt", etc.
 *
 * @param {string[]} testFiles - Array of test file names
 * @param {number} [testBegin] - Start of range (inclusive), optional
 * @param {number} [testEnd] - End of range (inclusive), optional
 * @returns {string[]} Filtered array of test files
 *
 * @example
 * const allTests = ['test1.txt', 'test2.txt', 'test3.txt'];
 * const filtered = filterTestsByRange(allTests, 1, 2);
 * // Returns: ['test1.txt', 'test2.txt']
 */
export declare function filterTestsByRange(testFiles: string[], testBegin?: number, testEnd?: number): string[];
/**
 * Gets all test files from tests directory.
 * Returns only files starting with 'test' prefix in sorted order by test number.
 *
 * @private
 * @param {string} testsDir - Path to tests directory
 * @returns {string[]} Array of test filenames
 *
 * @example
 * getTestFiles('/path/to/tests')
 * // Returns: ['test1.txt', 'test2.txt', 'test3.txt', ...]
 */
export declare function getTestFiles(testsDir: string): string[];
/**
 * Reads and parses the Config.json file from the current working directory.
 *
 * @returns {ConfigFile} Parsed configuration object
 *
 * @throws {Error} If Config.json doesn't exist or is invalid JSON
 *
 * @example
 * const config = readConfigFile();
 * console.log(config.solutions); // Array of solutions
 */
export declare function readConfigFile(): ConfigFile;
/**
 * Checks if a string represents a numeric value.
 *
 * @param {string} value - String to check
 * @returns {boolean} True if value is numeric
 *
 * @example
 * isNumeric('42');  // true
 * isNumeric('all'); // false
 */
export declare function isNumeric(value: string): boolean;
/**
 * Logs an error message with a cross icon.
 * Formats the error using the formatter.
 *
 * @param {unknown} error - Error to log
 *
 * @example
 * try {
 *   await compileCPP('invalid.cpp');
 * } catch (error) {
 *   logError(error);
 * }
 */
export declare function logError(error: unknown, indent?: number): void;
/**
 * Logs an error and exits the process with code 1.
 *
 * @param {unknown} error - Error to log
 *
 * @example
 * if (!fs.existsSync('Config.json')) {
 *   logErrorAndExit(new Error('Config.json not found'));
 * }
 */
export declare function logErrorAndExit(error: unknown): void;
/**
 * Logs an error and re-throws it.
 *
 * @param {unknown} error - Error to log and throw
 * @param {string} [message=''] - Additional context message
 *
 * @throws {Error} Always throws after logging
 *
 * @example
 * try {
 *   dangerousOperation();
 * } catch (error) {
 *   logErrorAndThrow(error, 'Operation failed');
 * }
 */
export declare function logErrorAndThrow(error: unknown, message?: string): void;
/**
 * Throws an error, ensuring it's an Error instance.
 * If the input is not an Error, wraps it in one.
 *
 * @param {unknown} error - Error to throw
 * @param {string} [message=''] - Additional context message
 *
 * @throws {Error} Always throws
 *
 * @example
 * throwError(new Error('Something went wrong'));
 */
export declare function throwError(error: unknown, message?: string): never;
/**
 * Ensures a directory exists, creating it if necessary.
 * Creates parent directories recursively.
 *
 * @param {string} dirName - Directory name/path relative to current working directory
 *
 * @example
 * ensureDirectoryExists('testsets');
 * ensureDirectoryExists('nested/path/to/dir');
 */
export declare function ensureDirectoryExists(dirName: string): void;
/**
 * Removes a directory and all its contents.
 * Does nothing if directory doesn't exist.
 *
 * @param {string} dirName - Directory name/path relative to current working directory
 *
 * @example
 * removeDirectoryRecursively('temp');
 */
export declare function removeDirectoryRecursively(dirName: string): void;
/**
 * Reads the first line of a file efficiently using streaming.
 * Useful for reading verdict from validator/checker output.
 *
 * @param {string} filePath - Path to the file
 * @returns {Promise<string>} First line of the file
 *
 * @throws {Error} If file cannot be read
 *
 * @example
 * const verdict = await readFirstLine('/tmp/validator_output.txt');
 * // Returns: 'VALID' or 'INVALID'
 */
export declare function readFirstLine(filePath: string): Promise<string>;
export declare function getCompiledCommandToRun(object: LocalChecker | LocalValidator | LocalSolution | LocalGenerator): string;
//# sourceMappingURL=utils.d.ts.map