namespace LiquidCode.Tester.Worker.Services;

public interface IExecutionService
{
    /// <summary>
    /// Executes a compiled program with input and captures output
    /// </summary>
    /// <param name="executablePath">Path to the executable</param>
    /// <param name="inputFilePath">Path to the input file</param>
    /// <param name="timeLimitMs">Time limit in milliseconds</param>
    /// <param name="memoryLimitMb">Memory limit in megabytes</param>
    /// <returns>Execution result</returns>
    Task<ExecutionResult> ExecuteAsync(string executablePath, string inputFilePath, int timeLimitMs, int memoryLimitMb);
}

public class ExecutionResult
{
    public bool Success { get; set; }
    public string Output { get; set; } = string.Empty;
    public string ErrorOutput { get; set; } = string.Empty;
    public int ExitCode { get; set; }
    public long ExecutionTimeMs { get; set; }
    public long MemoryUsedMb { get; set; }
    public bool TimeLimitExceeded { get; set; }
    public bool MemoryLimitExceeded { get; set; }
    public bool RuntimeError { get; set; }
    public string ErrorMessage { get; set; } = string.Empty;
}
