using System.Text.Json.Nodes;
using Nexus.Api.Data;
using Nexus.Api.Models;

namespace Nexus.Api.Services;

public interface IOpenClawRunGateway
{
    Task<OpenClawRunGatewayResult> StartAsync(
        OpenClawRun run,
        OpenClawInvocationMetadata invocation,
        CancellationToken cancellationToken = default);
    Task<OpenClawRunGatewayResult> StopAsync(
        OpenClawRun run,
        OpenClawInvocationMetadata invocation,
        CancellationToken cancellationToken = default);
    Task<OpenClawRunGatewayResult> GetHistoryAsync(
        OpenClawRun run,
        int limit,
        CancellationToken cancellationToken = default);
}

public sealed record OpenClawRunGatewayResult(
    bool Supported,
    bool Ok,
    string State,
    string Message,
    string? OpenClawRunId = null,
    JsonNode? Data = null);
