using System; using GameCult.Caching; using MessagePack; namespace GameCult.Networking { /// /// Portable manifest for one inspectable pipeline witness bundle. /// [MessagePackObject] [CultDocument("cultnet.witness_artifact_bundle", CultNetSchemaVersions.WitnessArtifactBundle)] public sealed class CultWitnessArtifactBundle { /// /// Gets or sets the stable bundle identifier. /// [Key(0)] [CultName] public string BundleId { get; set; } = string.Empty; /// /// Gets or sets the witness family or pipeline kind. /// [Key(1)] public string WitnessKind { get; set; } = string.Empty; /// /// Gets or sets when the manifest was captured. /// [Key(2)] public string CapturedAt { get; set; } = string.Empty; /// /// Gets or sets the pinned subject this witness bundle describes. /// [Key(3)] public CultWitnessSubjectPin Subject { get; set; } = new CultWitnessSubjectPin(); /// /// Gets or sets the schema and contract pins required to interpret the witness. /// [Key(4)] public CultWitnessContractPin[] Contracts { get; set; } = Array.Empty(); /// /// Gets or sets the inspectable artifact pointers carried by the bundle. /// [Key(5)] public CultWitnessArtifactEntry[] Artifacts { get; set; } = Array.Empty(); /// /// Gets or sets stage timing witnesses associated with the bundle. /// [Key(6)] public CultWitnessTimingEntry[] TimingWitnesses { get; set; } = Array.Empty(); /// /// Gets or sets provenance metadata for the bundle producer. /// [Key(7)] public CultWitnessProvenance Provenance { get; set; } = new CultWitnessProvenance(); } /// /// Pins the document or payload instance the witness is about. /// [MessagePackObject] public sealed class CultWitnessSubjectPin { /// /// Gets or sets the subject document type or domain identifier. /// [Key(0)] public string DocumentType { get; set; } = string.Empty; /// /// Gets or sets the persisted record key or equivalent stable subject id. /// [Key(1)] public string SubjectId { get; set; } = string.Empty; /// /// Gets or sets the pinned subject schema version. /// [Key(2)] public string? SchemaVersion { get; set; } /// /// Gets or sets the pinned subject schema identifier when one exists. /// [Key(3)] public string? SchemaId { get; set; } /// /// Gets or sets the pinned subject content hash when one exists. /// [Key(4)] public string? ContentHash { get; set; } } /// /// Pins one schema or contract dependency for the witness bundle. /// [MessagePackObject] public sealed class CultWitnessContractPin { [Key(4)] [CultElementId] public string Id { get; set; } = string.Empty; /// /// Gets or sets the contract role inside the bundle. /// [Key(0)] public string Role { get; set; } = string.Empty; /// /// Gets or sets the stable schema identifier. /// [Key(1)] public string SchemaId { get; set; } = string.Empty; /// /// Gets or sets the pinned schema version. /// [Key(2)] public string? SchemaVersion { get; set; } /// /// Gets or sets the canonical schema content hash when one exists. /// [Key(3)] public string? ContentHash { get; set; } } /// /// Points at one inspectable artifact emitted by the witnessed pipeline. /// [MessagePackObject] public sealed class CultWitnessArtifactEntry { [Key(6)] [CultElementId] public string Id { get; set; } = string.Empty; /// /// Gets or sets the artifact role inside the witness bundle. /// [Key(0)] public string Role { get; set; } = string.Empty; /// /// Gets or sets the portable URI for the artifact. /// [Key(1)] public string Uri { get; set; } = string.Empty; /// /// Gets or sets the artifact media type. /// [Key(2)] public string MediaType { get; set; } = string.Empty; /// /// Gets or sets the artifact content hash when one exists. /// [Key(3)] public string? ContentHash { get; set; } /// /// Gets or sets the artifact size in bytes when known. /// [Key(4)] public long? ByteLength { get; set; } /// /// Gets or sets when the artifact was produced. /// [Key(5)] public string? ProducedAt { get; set; } } /// /// Records timestamp and latency evidence for one stage in the witnessed pipeline. /// [MessagePackObject] public sealed class CultWitnessTimingEntry { [Key(5)] [CultElementId] public string Id { get; set; } = string.Empty; /// /// Gets or sets the pipeline stage name. /// [Key(0)] public string Stage { get; set; } = string.Empty; /// /// Gets or sets when the stage started. /// [Key(1)] public string StartedAt { get; set; } = string.Empty; /// /// Gets or sets when the stage completed. /// [Key(2)] public string CompletedAt { get; set; } = string.Empty; /// /// Gets or sets the observed stage latency in milliseconds. /// [Key(3)] public double LatencyMs { get; set; } /// /// Gets or sets the URI for the timing witness artifact when one exists. /// [Key(4)] public string? WitnessArtifactUri { get; set; } } /// /// Carries provenance metadata for the witness bundle producer. /// [MessagePackObject] public sealed class CultWitnessProvenance { /// /// Gets or sets the stable pipeline identifier. /// [Key(0)] public string PipelineId { get; set; } = string.Empty; /// /// Gets or sets the pipeline run identifier. /// [Key(1)] public string RunId { get; set; } = string.Empty; /// /// Gets or sets the runtime identifier that produced the bundle. /// [Key(2)] public string RuntimeId { get; set; } = string.Empty; /// /// Gets or sets the producing agent identifier when one exists. /// [Key(3)] public string? AgentId { get; set; } /// /// Gets or sets the producing agent role when one exists. /// [Key(4)] public string? AgentRole { get; set; } /// /// Gets or sets the pipeline or tool version when one exists. /// [Key(5)] public string? ToolVersion { get; set; } } }