using System.Collections.Generic; using System.Collections.Immutable; using System.Text.Json; using System.Text.Json.Serialization; using StellaOps.Concelier.Core.Attestation; using StellaOps.Concelier.RawModels; namespace StellaOps.Concelier.WebService.Contracts; public sealed record AdvisoryIngestRequest( AdvisorySourceRequest Source, AdvisoryUpstreamRequest Upstream, AdvisoryContentRequest Content, AdvisoryIdentifiersRequest Identifiers, AdvisoryLinksetRequest? Linkset); public sealed record AdvisorySourceRequest( [property: JsonPropertyName("vendor")] string Vendor, [property: JsonPropertyName("connector")] string Connector, [property: JsonPropertyName("version")] string Version, [property: JsonPropertyName("stream")] string? Stream); public sealed record AdvisoryUpstreamRequest( [property: JsonPropertyName("upstreamId")] string UpstreamId, [property: JsonPropertyName("documentVersion")] string? DocumentVersion, [property: JsonPropertyName("retrievedAt")] DateTimeOffset? RetrievedAt, [property: JsonPropertyName("contentHash")] string ContentHash, [property: JsonPropertyName("signature")] AdvisorySignatureRequest Signature, [property: JsonPropertyName("provenance")] IDictionary? Provenance); public sealed record AdvisorySignatureRequest( [property: JsonPropertyName("present")] bool Present, [property: JsonPropertyName("format")] string? Format, [property: JsonPropertyName("keyId")] string? KeyId, [property: JsonPropertyName("sig")] string? Signature, [property: JsonPropertyName("certificate")] string? Certificate, [property: JsonPropertyName("digest")] string? Digest); public sealed record AdvisoryContentRequest( [property: JsonPropertyName("format")] string Format, [property: JsonPropertyName("specVersion")] string? SpecVersion, [property: JsonPropertyName("raw")] JsonElement Raw, [property: JsonPropertyName("encoding")] string? Encoding); public sealed record AdvisoryIdentifiersRequest( [property: JsonPropertyName("primary")] string Primary, [property: JsonPropertyName("aliases")] IReadOnlyList? Aliases); public sealed record AdvisoryLinksetRequest( [property: JsonPropertyName("aliases")] IReadOnlyList? Aliases, [property: JsonPropertyName("scopes")] IReadOnlyList? Scopes, [property: JsonPropertyName("relationships")] IReadOnlyList? Relationships, [property: JsonPropertyName("purls")] IReadOnlyList? PackageUrls, [property: JsonPropertyName("cpes")] IReadOnlyList? Cpes, [property: JsonPropertyName("references")] IReadOnlyList? References, [property: JsonPropertyName("reconciledFrom")] IReadOnlyList? ReconciledFrom, [property: JsonPropertyName("notes")] IDictionary? Notes); public sealed record AdvisoryLinksetRelationshipRequest( [property: JsonPropertyName("type")] string Type, [property: JsonPropertyName("source")] string Source, [property: JsonPropertyName("target")] string Target, [property: JsonPropertyName("provenance")] string? Provenance); public sealed record AdvisoryLinksetReferenceRequest( [property: JsonPropertyName("type")] string Type, [property: JsonPropertyName("url")] string Url, [property: JsonPropertyName("source")] string? Source); public sealed record AdvisoryIngestResponse( [property: JsonPropertyName("id")] string Id, [property: JsonPropertyName("inserted")] bool Inserted, [property: JsonPropertyName("tenant")] string Tenant, [property: JsonPropertyName("contentHash")] string ContentHash, [property: JsonPropertyName("supersedes")] string? Supersedes, [property: JsonPropertyName("ingestedAt")] DateTimeOffset IngestedAt, [property: JsonPropertyName("createdAt")] DateTimeOffset CreatedAt); public sealed record AdvisoryRawRecordResponse( [property: JsonPropertyName("id")] string Id, [property: JsonPropertyName("tenant")] string Tenant, [property: JsonPropertyName("ingestedAt")] DateTimeOffset IngestedAt, [property: JsonPropertyName("createdAt")] DateTimeOffset CreatedAt, [property: JsonPropertyName("document")] AdvisoryRawDocument Document); public sealed record AdvisoryRawListResponse( [property: JsonPropertyName("records")] IReadOnlyList Records, [property: JsonPropertyName("nextCursor")] string? NextCursor, [property: JsonPropertyName("hasMore")] bool HasMore); public sealed record AdvisoryEvidenceResponse( [property: JsonPropertyName("advisoryKey")] string AdvisoryKey, [property: JsonPropertyName("records")] IReadOnlyList Records, [property: JsonPropertyName("attestation")] AttestationClaims? Attestation); public sealed record AdvisoryRawProvenanceResponse( [property: JsonPropertyName("id")] string Id, [property: JsonPropertyName("tenant")] string Tenant, [property: JsonPropertyName("source")] RawSourceMetadata Source, [property: JsonPropertyName("upstream")] RawUpstreamMetadata Upstream, [property: JsonPropertyName("supersedes")] string? Supersedes, [property: JsonPropertyName("ingestedAt")] DateTimeOffset IngestedAt, [property: JsonPropertyName("createdAt")] DateTimeOffset CreatedAt); public sealed record AocVerifyRequest( [property: JsonPropertyName("since")] DateTimeOffset? Since, [property: JsonPropertyName("until")] DateTimeOffset? Until, [property: JsonPropertyName("limit")] int? Limit, [property: JsonPropertyName("sources")] IReadOnlyList? Sources, [property: JsonPropertyName("codes")] IReadOnlyList? Codes); public sealed record AocVerifyResponse( [property: JsonPropertyName("tenant")] string Tenant, [property: JsonPropertyName("window")] AocVerifyWindow Window, [property: JsonPropertyName("checked")] AocVerifyChecked Checked, [property: JsonPropertyName("violations")] IReadOnlyList Violations, [property: JsonPropertyName("metrics")] AocVerifyMetrics Metrics, [property: JsonPropertyName("truncated")] bool Truncated); public sealed record AocVerifyWindow( [property: JsonPropertyName("from")] DateTimeOffset From, [property: JsonPropertyName("to")] DateTimeOffset To); public sealed record AocVerifyChecked( [property: JsonPropertyName("advisories")] int Advisories, [property: JsonPropertyName("vex")] int Vex); public sealed record AocVerifyMetrics( [property: JsonPropertyName("ingestion_write_total")] int IngestionWriteTotal, [property: JsonPropertyName("aoc_violation_total")] int AocViolationTotal); public sealed record AocVerifyViolation( [property: JsonPropertyName("code")] string Code, [property: JsonPropertyName("count")] int Count, [property: JsonPropertyName("examples")] IReadOnlyList Examples); public sealed record AocVerifyViolationExample( [property: JsonPropertyName("source")] string Source, [property: JsonPropertyName("documentId")] string DocumentId, [property: JsonPropertyName("contentHash")] string ContentHash, [property: JsonPropertyName("path")] string Path);