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

namespace Nexus.Api.Services;

public interface IOpenClawControlService
{
    OpenClawConnectionDto GetConnection();
    IReadOnlyList<OpenClawCapabilityDto> GetCapabilities();
    Task<OpenClawOverviewDto> GetOverviewAsync(CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawTaskDto>> GetTasksAsync(
        int limit = 100,
        string? cursor = null,
        CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawSessionDto>> GetSessionsAsync(
        int limit = 100,
        CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawCronJobDto>> GetCronJobsAsync(
        int limit = 100,
        CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawCronJobDto>> GetCronJobsAsync(
        bool includeDisabled,
        int limit = 100,
        string? cursor = null,
        CancellationToken cancellationToken = default);
    Task<OpenClawOperationDto<OpenClawCronJobDetailDto>> GetCronJobAsync(
        string jobId,
        CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawCronRunDto>> GetCronRunsAsync(
        string jobId,
        int limit = 100,
        string? cursor = null,
        string? runId = null,
        CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawApprovalDto>> GetApprovalsAsync(
        int limit = 100,
        CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawActivityDto>> GetActivityAsync(
        int limit = 100,
        string? cursor = null,
        CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawModelDto>> GetModelsAsync(
        CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawModelAuthProviderDto>> GetModelAuthStatusAsync(
        bool refresh = false,
        CancellationToken cancellationToken = default);
    Task<OpenClawCollectionDto<OpenClawAgentDto>> GetAgentsAsync(
        CancellationToken cancellationToken = default);
    Task<OpenClawOperationDto<OpenClawTaskDto>> CancelTaskAsync(
        string taskId,
        string? reason,
        CancellationToken cancellationToken = default,
        OpenClawInvocationContext? invocationContext = null);
    Task<OpenClawOperationDto<object>> AbortSessionAsync(
        string sessionKey,
        string? runId,
        bool clearQueued,
        CancellationToken cancellationToken = default,
        OpenClawInvocationContext? invocationContext = null);
    Task<OpenClawOperationDto<object>> PatchSessionModelAsync(
        string sessionKey,
        string model,
        CancellationToken cancellationToken = default,
        OpenClawInvocationContext? invocationContext = null);
    Task<OpenClawOperationDto<object>> RunCronJobAsync(
        string jobId,
        CancellationToken cancellationToken = default,
        OpenClawInvocationContext? invocationContext = null);
    Task<OpenClawOperationDto<object>> RunCronJobAsync(
        string jobId,
        string? expectedHash,
        CancellationToken cancellationToken = default,
        OpenClawInvocationContext? invocationContext = null);
    Task<OpenClawOperationDto<OpenClawCronJobDetailDto>> CreateCronJobAsync(
        CreateOpenClawCronJobRequest request,
        CancellationToken cancellationToken = default,
        OpenClawInvocationContext? invocationContext = null);
    Task<OpenClawOperationDto<OpenClawCronJobDetailDto>> PatchCronJobAsync(
        string jobId,
        JsonObject patch,
        string? expectedHash,
        CancellationToken cancellationToken = default,
        OpenClawInvocationContext? invocationContext = null);
    Task<OpenClawOperationDto<object>> DeleteCronJobAsync(
        string jobId,
        string? expectedHash = null,
        CancellationToken cancellationToken = default,
        OpenClawInvocationContext? invocationContext = null);
    Task<OpenClawOperationDto<OpenClawApprovalDto>> ResolveApprovalAsync(
        string approvalId,
        string kind,
        string decision,
        CancellationToken cancellationToken = default,
        OpenClawInvocationContext? invocationContext = null);
}
