namespace Nexus.Api.Models;

public sealed record CreateAgentProposalRequest(
    string Name,
    string? Role = null,
    string? Description = null,
    string? Model = null,
    string? Emoji = null,
    string? Avatar = null,
    IReadOnlyDictionary<string, string>? Files = null,
    string? ClientRequestId = null);

public sealed record AgentProposalActionRequest(
    int ExpectedRevision,
    string? Reason = null);

public sealed record AgentProposalFileDto(
    string Name,
    string ContentHash,
    int Size,
    string? Content = null);

public sealed record AgentProposalErrorDto(
    string Code,
    string Message,
    string? Recovery = null);

public sealed record AgentProposalDto(
    Guid Id,
    string Source,
    string RequestedName,
    string RequestedAgentId,
    string? Role,
    string? Description,
    string? Model,
    string? Emoji,
    string? Avatar,
    string Workspace,
    IReadOnlyList<AgentProposalFileDto> Files,
    string Status,
    string RequestedBy,
    string? ApprovedBy,
    string? RejectedBy,
    string? RejectionReason,
    string? OpenClawAgentId,
    string? OpenClawWorkspace,
    AgentProposalErrorDto? Error,
    int Revision,
    DateTimeOffset CreatedAt,
    DateTimeOffset UpdatedAt,
    DateTimeOffset? ApprovedAt,
    DateTimeOffset? RejectedAt,
    DateTimeOffset? CompletedAt);

public sealed record AgentProposalCollectionDto(
    IReadOnlyList<AgentProposalDto> Items,
    string? NextCursor,
    DateTimeOffset CheckedAt);

public sealed record AgentProposalOperationDto(
    bool Ok,
    string State,
    string Message,
    AgentProposalDto? Proposal,
    string? Recovery,
    string CorrelationId,
    DateTimeOffset CompletedAt,
    OperationResultDto? Operation = null);

public sealed record AgentCreateModelOptionDto(
    string Id,
    string Name,
    string Provider,
    bool Available);

public sealed record AgentCreateOptionsDto(
    bool CanSubmitProposal,
    bool CanProvision,
    string State,
    string? Reason,
    string WorkspaceRoot,
    IReadOnlyList<string> ExistingAgentIds,
    IReadOnlyList<AgentCreateModelOptionDto> Models,
    IReadOnlyList<string> StandardFiles,
    DateTimeOffset CheckedAt);

/// <summary>
/// Structured MCP result. Proposal markdown is intentionally omitted.
/// </summary>
public sealed record AgentProposalToolResult(
    bool Ok,
    string State,
    string Message,
    AgentProposalDto? Proposal,
    string? Recovery);
