using System.Text.Json.Serialization;
namespace StellaOps.Scanner.WebService.Contracts;
///
/// Call graph submission request (CallGraphV1 schema).
///
public sealed record CallGraphV1Dto(
[property: JsonPropertyName("schema")] string Schema,
[property: JsonPropertyName("scanKey")] string ScanKey,
[property: JsonPropertyName("language")] string Language,
[property: JsonPropertyName("nodes")] IReadOnlyList Nodes,
[property: JsonPropertyName("edges")] IReadOnlyList Edges,
[property: JsonPropertyName("artifacts")] IReadOnlyList? Artifacts = null,
[property: JsonPropertyName("entrypoints")] IReadOnlyList? Entrypoints = null);
///
/// Artifact in a call graph.
///
public sealed record CallGraphArtifactDto(
[property: JsonPropertyName("artifactKey")] string ArtifactKey,
[property: JsonPropertyName("kind")] string? Kind = null,
[property: JsonPropertyName("sha256")] string? Sha256 = null);
///
/// Node in a call graph.
///
public sealed record CallGraphNodeDto(
[property: JsonPropertyName("nodeId")] string NodeId,
[property: JsonPropertyName("symbolKey")] string SymbolKey,
[property: JsonPropertyName("artifactKey")] string? ArtifactKey = null,
[property: JsonPropertyName("visibility")] string? Visibility = null,
[property: JsonPropertyName("isEntrypointCandidate")] bool IsEntrypointCandidate = false);
///
/// Edge in a call graph.
///
public sealed record CallGraphEdgeDto(
[property: JsonPropertyName("from")] string From,
[property: JsonPropertyName("to")] string To,
[property: JsonPropertyName("kind")] string Kind = "static",
[property: JsonPropertyName("reason")] string? Reason = null,
[property: JsonPropertyName("weight")] double Weight = 1.0);
///
/// Entrypoint in a call graph.
///
public sealed record CallGraphEntrypointDto(
[property: JsonPropertyName("nodeId")] string NodeId,
[property: JsonPropertyName("kind")] string Kind,
[property: JsonPropertyName("route")] string? Route = null,
[property: JsonPropertyName("framework")] string? Framework = null);
///
/// Response when call graph is accepted.
///
public sealed record CallGraphAcceptedResponseDto(
[property: JsonPropertyName("callgraphId")] string CallgraphId,
[property: JsonPropertyName("nodeCount")] int NodeCount,
[property: JsonPropertyName("edgeCount")] int EdgeCount,
[property: JsonPropertyName("digest")] string Digest);
///
/// Existing call graph reference (for duplicate detection).
///
public sealed record ExistingCallGraphDto(
[property: JsonPropertyName("id")] string Id,
[property: JsonPropertyName("digest")] string Digest,
[property: JsonPropertyName("createdAt")] DateTimeOffset CreatedAt);