namespace w4c_workflows.Models.Nodes;
// ---------------------------------------------------------------------------
// A declarative REST connector definition attached to a blueprint. It is what
// turns a plain catalog entry into a runnable integration node without a new C#
// executor per service: the blueprint says WHICH request to make, and the shared
// RestConnectorExecutor makes it (egress-vetted, quota-metered) and maps the
// response. Adding an integration should be data, not code.
//
// The URL is a template. `{name}` resolves from the node's (already
// interpolated) parameters; `{credential.field}` resolves from the field of the
// credential the blueprint references. Example (Telegram):
//
// baseUrl + path = "https://api.telegram.org" + "/bot{credential.token}/{operation}"
//
// Body/query come from a parameter holding a JSON object, so per-operation
// payloads stay in the workflow, not in the connector.
// ---------------------------------------------------------------------------
/// Where a connector gets its request body/query and how it maps the response.
public sealed record NodeConnector
{
/// Scheme + host (may itself contain {param}/{credential.field}).
public string BaseUrl { get; init; } = string.Empty;
/// Path template appended to .
public string Path { get; init; } = string.Empty;
/// HTTP method, e.g. POST.
public string Method { get; init; } = "POST";
/// Request body encoding: json, form or none.
public string ContentType { get; init; } = "json";
/// Parameter holding the JSON object sent as the body (null to send none).
public string? BodyParameter { get; init; } = "body";
/// Parameter holding a JSON object appended as query parameters.
public string? QueryParameter { get; init; } = "query";
/// Credential alias whose data backs {credential.*} placeholders.
public string? CredentialAlias { get; init; }
/// Dot path in the JSON response that holds the payload (e.g. result).
public string? ResponsePath { get; init; }
}