using System; using MessagePack; namespace GameCult.Networking { /// /// Shared wire-contract identifiers understood by the CultNet family. /// public static class CultNetWireContracts { /// /// schema v0 contract identifier. /// public const string SchemaV0 = "cultnet.schema.v0"; /// /// game cult networking v0 contract identifier. /// public const string GameCultNetworkingV0 = "gamecult.networking.v0"; } /// /// Canonical schema-version strings for the modern CultNet message family. /// public static class CultNetSchemaVersions { /// /// hello contract identifier. /// public const string Hello = "cultnet.hello.v0"; /// /// login contract identifier. /// public const string Login = "cultnet.login.v0"; /// /// register contract identifier. /// public const string Register = "cultnet.register.v0"; /// /// verify contract identifier. /// public const string Verify = "cultnet.verify.v0"; /// /// login success contract identifier. /// public const string LoginSuccess = "cultnet.login_success.v0"; /// /// error contract identifier. /// public const string Error = "cultnet.error.v0"; /// /// sample change name contract identifier. /// public const string SampleChangeName = "cultnet.sample.change_name.v0"; /// /// sample chat contract identifier. /// public const string SampleChat = "cultnet.sample.chat.v0"; /// /// document delete contract identifier. /// public const string DocumentDelete = "cultnet.document_delete.v0"; /// /// document put raw contract identifier. /// public const string DocumentPutRaw = "cultnet.document_put_raw.v0"; /// /// snapshot request contract identifier. /// public const string SnapshotRequest = "cultnet.snapshot_request.v0"; /// /// snapshot response raw contract identifier. /// public const string SnapshotResponseRaw = "cultnet.snapshot_response_raw.v0"; /// /// schema catalog request contract identifier. /// public const string SchemaCatalogRequest = "cultnet.schema_catalog_request.v0"; /// /// schema catalog response contract identifier. /// public const string SchemaCatalogResponse = "cultnet.schema_catalog_response.v0"; /// /// database subscription request contract identifier. /// public const string DatabaseSubscribe = "cultnet.database_subscribe.v0"; /// /// database subscription cancel contract identifier. /// public const string DatabaseUnsubscribe = "cultnet.database_unsubscribe.v0"; /// /// database subscription change contract identifier. /// public const string DatabaseChangeRaw = "cultnet.database_change_raw.v0"; /// /// shard catalog request contract identifier. /// public const string ShardCatalogRequest = "cultnet.shard_catalog_request.v0"; /// /// shard catalog response contract identifier. /// public const string ShardCatalogResponse = "cultnet.shard_catalog_response.v0"; /// /// shard mutation log request contract identifier. /// public const string ShardLogRequest = "cultnet.shard_log_request.v0"; /// /// shard mutation log response contract identifier. /// public const string ShardLogResponse = "cultnet.shard_log_response.v0"; /// /// simulation observation gossip contract identifier. /// public const string SimulationObservation = "cultnet.simulation_observation.v0"; /// /// simulation consensus candidate gossip contract identifier. /// public const string SimulationConsensusCandidate = "cultnet.simulation_consensus_candidate.v0"; } /// /// Mutation authority owner identifiers advertised through CultNet mutation contracts. /// public static class CultNetMutationAuthorities { /// /// The document is inspectable but not writable through CultNet. /// public const string ReadOnly = "readOnly"; /// /// The local human operator may submit the corresponding mutation intent. /// public const string LocalUser = "localUser"; /// /// A coordinator-owned Epiphany control surface owns the mutation path. /// public const string Coordinator = "coordinator"; /// /// The runtime itself may write this document directly. /// public const string Runtime = "runtime"; /// /// The document should not be mutated through CultNet. /// public const string Denied = "denied"; } /// /// Declares how a document or surface may be inspected and mutated over CultNet. /// [MessagePackObject] public class CultNetDocumentMutationContract { /// /// Gets or sets the stable document type governed by this contract. /// [Key("documentType")] public string DocumentType { get; set; } = string.Empty; /// /// Gets or sets the payload schema version when the contract governs a versioned document payload. /// [Key("payloadSchemaVersion")] public string? PayloadSchemaVersion { get; set; } /// /// Gets or sets the CultNet operations this document accepts. /// [Key("operations")] public string[] Operations { get; set; } = Array.Empty(); /// /// Gets or sets which actor is allowed to drive those operations. /// [Key("authority")] public string Authority { get; set; } = CultNetMutationAuthorities.ReadOnly; /// /// Gets or sets the intent document types a client may submit to request mutation. /// [Key("intentDocumentTypes")] public string[]? IntentDocumentTypes { get; set; } /// /// Gets or sets the receipt document types emitted after a successful mutation path. /// [Key("receiptDocumentTypes")] public string[]? ReceiptDocumentTypes { get; set; } /// /// Gets or sets freeform notes that explain local mutation guardrails or posture. /// [Key("notes")] public string[]? Notes { get; set; } } /// /// Marker interface for the explicit modern CultNet schema-v0 message family. /// public interface ICultNetSchemaMessage { /// /// Gets or sets the schema version carried by this message. /// string SchemaVersion { get; set; } } /// /// CultNet hello message used to announce a runtime and its supported contracts. /// [MessagePackObject] public class CultNetHelloMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.Hello; /// /// Gets or sets the runtime id. /// [Key("runtimeId")] public string RuntimeId { get; set; } = string.Empty; /// /// Gets or sets the runtime kind. /// [Key("runtimeKind")] public string RuntimeKind { get; set; } = string.Empty; /// /// Gets or sets the agent id. /// [Key("agentId")] public string? AgentId { get; set; } /// /// Gets or sets the role. /// [Key("role")] public string? Role { get; set; } /// /// Gets or sets the display name. /// [Key("displayName")] public string? DisplayName { get; set; } /// /// Gets or sets the supported document types. /// [Key("supportedDocumentTypes")] public string[]? SupportedDocumentTypes { get; set; } /// /// Gets or sets the supported mutation contracts. /// [Key("supportedMutationContracts")] public CultNetDocumentMutationContract[]? SupportedMutationContracts { get; set; } /// /// Gets or sets the supported message versions. /// [Key("supportedMessageVersions")] public string[]? SupportedMessageVersions { get; set; } /// /// Gets or sets the supports schema catalog. /// [Key("supportsSchemaCatalog")] public bool SupportsSchemaCatalog { get; set; } } /// /// CultNet login request message. /// [MessagePackObject] public class CultNetLoginMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.Login; /// /// Gets or sets the nonce. /// [Key("nonce")] public string Nonce { get; set; } = string.Empty; /// /// Gets or sets the auth. /// [Key("auth")] public string Auth { get; set; } = string.Empty; /// /// Gets or sets the password. /// [Key("password")] public string Password { get; set; } = string.Empty; } /// /// CultNet registration request message. /// [MessagePackObject] public class CultNetRegisterMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.Register; /// /// Gets or sets the nonce. /// [Key("nonce")] public string Nonce { get; set; } = string.Empty; /// /// Gets or sets the email. /// [Key("email")] public string Email { get; set; } = string.Empty; /// /// Gets or sets the password. /// [Key("password")] public string Password { get; set; } = string.Empty; /// /// Gets or sets the name. /// [Key("name")] public string Name { get; set; } = string.Empty; } /// /// CultNet session verification request message. /// [MessagePackObject] public class CultNetVerifyMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.Verify; /// /// Gets or sets the nonce. /// [Key("nonce")] public string Nonce { get; set; } = string.Empty; /// /// Gets or sets the session. /// [Key("session")] public string Session { get; set; } = string.Empty; } /// /// CultNet message returned after successful session verification. /// [MessagePackObject] public class CultNetLoginSuccessMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.LoginSuccess; /// /// Gets or sets the nonce. /// [Key("nonce")] public string Nonce { get; set; } = string.Empty; /// /// Gets or sets the session. /// [Key("session")] public string Session { get; set; } = string.Empty; } /// /// CultNet error response message. /// [MessagePackObject] public class CultNetErrorMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.Error; /// /// Gets or sets the error. /// [Key("error")] public string Error { get; set; } = string.Empty; /// /// Gets or sets optional shard routing details for authority failures. /// [Key("routingHint")] public CultNetShardRoutingHint? RoutingHint { get; set; } } /// /// Describes where a shard write should be routed. /// [MessagePackObject] public class CultNetShardRoutingHint { /// /// Gets or sets the shard descriptor. /// [Key("shard")] public CultNetShardDescriptorMessage? Shard { get; set; } /// /// Gets or sets a machine-readable routing reason. /// [Key("reason")] public string Reason { get; set; } = string.Empty; } /// /// Sample CultNet message used by development clients to change a display name. /// [MessagePackObject] public class CultNetSampleChangeNameMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.SampleChangeName; /// /// Gets or sets the name. /// [Key("name")] public string Name { get; set; } = string.Empty; } /// /// Sample CultNet chat message used by development clients. /// [MessagePackObject] public class CultNetSampleChatMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.SampleChat; /// /// Gets or sets the text. /// [Key("text")] public string Text { get; set; } = string.Empty; } /// /// Raw document record carried over CultNet. /// [MessagePackObject] public class CultNetRawDocumentRecord { /// /// Gets or sets the schema id. /// [Key("schemaId")] public string SchemaId { get; set; } = string.Empty; /// /// Gets or sets the record key. /// [Key("recordKey")] public string RecordKey { get; set; } = string.Empty; /// /// Gets or sets the stored at. /// [Key("storedAt")] public string StoredAt { get; set; } = string.Empty; /// /// Gets or sets the payload encoding. /// [Key("payloadEncoding")] public string PayloadEncoding { get; set; } = "messagepack"; /// /// Gets or sets the payload. /// [Key("payload")] public byte[] Payload { get; set; } = Array.Empty(); /// /// Gets or sets the source runtime id. /// [Key("sourceRuntimeId")] public string? SourceRuntimeId { get; set; } /// /// Gets or sets the source agent id. /// [Key("sourceAgentId")] public string? SourceAgentId { get; set; } /// /// Gets or sets the source role. /// [Key("sourceRole")] public string? SourceRole { get; set; } /// /// Gets or sets the tags. /// [Key("tags")] public string[]? Tags { get; set; } } /// /// CultNet message requesting deletion of a document record. /// [MessagePackObject] public class CultNetDocumentDeleteMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.DocumentDelete; /// /// Gets or sets the message id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the schema id. /// [Key("schemaId")] public string SchemaId { get; set; } = string.Empty; /// /// Gets or sets the record key. /// [Key("recordKey")] public string RecordKey { get; set; } = string.Empty; /// /// Gets or sets the shard id the sender targeted. /// [Key("shardId")] public string? ShardId { get; set; } /// /// Gets or sets the shard epoch the sender targeted. /// [Key("shardEpoch")] public long? ShardEpoch { get; set; } } /// /// CultNet message carrying one raw document record. /// [MessagePackObject] public class CultNetDocumentPutRawMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.DocumentPutRaw; /// /// Gets or sets the message id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the document. /// [Key("document")] public CultNetRawDocumentRecord Document { get; set; } = new CultNetRawDocumentRecord(); /// /// Gets or sets the shard id the sender targeted. /// [Key("shardId")] public string? ShardId { get; set; } /// /// Gets or sets the shard epoch the sender targeted. /// [Key("shardEpoch")] public long? ShardEpoch { get; set; } } /// /// CultNet message requesting a document snapshot. /// [MessagePackObject] public class CultNetSnapshotRequestMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.SnapshotRequest; /// /// Gets or sets the message id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the schema ids. /// [Key("schemaIds")] public string[]? SchemaIds { get; set; } /// /// Gets or sets the record keys. /// [Key("recordKeys")] public string[]? RecordKeys { get; set; } } /// /// CultNet message returning raw document records from a snapshot request. /// [MessagePackObject] public class CultNetSnapshotResponseRawMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.SnapshotResponseRaw; /// /// Gets or sets the message id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the documents. /// [Key("documents")] public CultNetRawDocumentRecord[] Documents { get; set; } = Array.Empty(); } /// /// Requests a live database subscription. /// [MessagePackObject] public class CultNetDatabaseSubscribeMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.DatabaseSubscribe; /// /// Gets or sets the request id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the live subscription id. /// [Key("subscriptionId")] public string SubscriptionId { get; set; } = string.Empty; /// /// Gets or sets optional schema ids to watch. /// [Key("schemaIds")] public string[]? SchemaIds { get; set; } /// /// Gets or sets optional record keys to watch. /// [Key("recordKeys")] public string[]? RecordKeys { get; set; } /// /// Gets or sets whether the server should send a matching snapshot before live changes. /// [Key("includeSnapshot")] public bool IncludeSnapshot { get; set; } = true; } /// /// Cancels a live database subscription. /// [MessagePackObject] public class CultNetDatabaseUnsubscribeMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.DatabaseUnsubscribe; /// /// Gets or sets the request id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the live subscription id. /// [Key("subscriptionId")] public string SubscriptionId { get; set; } = string.Empty; } /// /// Streams one raw document change for a live database subscription. /// [MessagePackObject] public class CultNetDatabaseChangeRawMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.DatabaseChangeRaw; /// /// Gets or sets the message id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the live subscription id. /// [Key("subscriptionId")] public string SubscriptionId { get; set; } = string.Empty; /// /// Gets or sets the change kind. /// [Key("changeKind")] public string ChangeKind { get; set; } = string.Empty; /// /// Gets or sets the current document for added or updated changes. /// [Key("document")] public CultNetRawDocumentRecord? Document { get; set; } /// /// Gets or sets the deleted record key for removed changes. /// [Key("recordKey")] public string? RecordKey { get; set; } /// /// Gets or sets the deleted schema id for removed changes. /// [Key("schemaId")] public string? SchemaId { get; set; } } /// /// Describes one shard advertised by a CultNet database node. /// [MessagePackObject] public class CultNetShardDescriptorMessage { /// /// Gets or sets the shard id. /// [Key("shardId")] public string ShardId { get; set; } = string.Empty; /// /// Gets or sets the owner runtime id. /// [Key("ownerRuntimeId")] public string OwnerRuntimeId { get; set; } = string.Empty; /// /// Gets or sets the shard authority epoch. /// [Key("epoch")] public long Epoch { get; set; } /// /// Gets or sets whether the responding node is primary for this shard. /// [Key("isPrimary")] public bool IsPrimary { get; set; } /// /// Gets or sets schema ids governed by this shard. Empty means all schemas. /// [Key("schemaIds")] public string[] SchemaIds { get; set; } = Array.Empty(); /// /// Gets or sets the record-key prefix governed by this shard. /// [Key("keyPrefix")] public string? KeyPrefix { get; set; } /// /// Gets or sets endpoints that accept authoritative writes. /// [Key("primaryEndpoints")] public string[] PrimaryEndpoints { get; set; } = Array.Empty(); /// /// Gets or sets authoritative replica endpoints. /// [Key("replicaEndpoints")] public string[] ReplicaEndpoints { get; set; } = Array.Empty(); /// /// Gets or sets low-latency read replica endpoints. /// [Key("readReplicaEndpoints")] public string[] ReadReplicaEndpoints { get; set; } = Array.Empty(); /// /// Gets or sets an optional locality label. /// [Key("region")] public string? Region { get; set; } } /// /// Requests shard ownership and routing metadata. /// [MessagePackObject] public class CultNetShardCatalogRequestMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.ShardCatalogRequest; /// /// Gets or sets the request id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets optional schema filters. /// [Key("schemaIds")] public string[]? SchemaIds { get; set; } /// /// Gets or sets optional record-key filters. /// [Key("recordKeys")] public string[]? RecordKeys { get; set; } } /// /// Returns shard ownership and routing metadata. /// [MessagePackObject] public class CultNetShardCatalogResponseMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.ShardCatalogResponse; /// /// Gets or sets the request id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets shard descriptors. /// [Key("shards")] public CultNetShardDescriptorMessage[] Shards { get; set; } = Array.Empty(); } /// /// Requests accepted mutation log entries for a shard. /// [MessagePackObject] public class CultNetShardLogRequestMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.ShardLogRequest; /// /// Gets or sets the request id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the shard id. /// [Key("shardId")] public string ShardId { get; set; } = string.Empty; /// /// Gets or sets the shard epoch expected by the requester. /// [Key("shardEpoch")] public long? ShardEpoch { get; set; } /// /// Gets or sets the last sequence already held by the requester. /// [Key("afterSequence")] public long AfterSequence { get; set; } /// /// Gets or sets the maximum number of entries to return. /// [Key("limit")] public int? Limit { get; set; } } /// /// Returns accepted mutation log entries for a shard. /// [MessagePackObject] public class CultNetShardLogResponseMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.ShardLogResponse; /// /// Gets or sets the request id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the shard id. /// [Key("shardId")] public string ShardId { get; set; } = string.Empty; /// /// Gets or sets the shard epoch. /// [Key("shardEpoch")] public long ShardEpoch { get; set; } /// /// Gets or sets mutation log entries. /// [Key("entries")] public CultNetShardLogEntryMessage[] Entries { get; set; } = Array.Empty(); /// /// Gets or sets whether the requester must fall back to a shard snapshot. /// [Key("resyncRequired")] public bool ResyncRequired { get; set; } /// /// Gets or sets a machine-readable resync reason. /// [Key("reason")] public string? Reason { get; set; } } /// /// Describes one accepted shard mutation for replica catch-up. /// [MessagePackObject] public class CultNetShardLogEntryMessage { /// /// Gets or sets the per-shard sequence. /// [Key("sequence")] public long Sequence { get; set; } /// /// Gets or sets the commit timestamp. /// [Key("committedAt")] public string CommittedAt { get; set; } = string.Empty; /// /// Gets or sets the mutation kind. /// [Key("changeKind")] public string ChangeKind { get; set; } = string.Empty; /// /// Gets or sets a raw put message for added/updated entries. /// [Key("put")] public CultNetDocumentPutRawMessage? Put { get; set; } /// /// Gets or sets a raw delete message for removed entries. /// [Key("delete")] public CultNetDocumentDeleteMessage? Delete { get; set; } } /// /// Carries one witness observation about a simulation fact. /// [MessagePackObject] public class CultNetSimulationObservationMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.SimulationObservation; /// /// Gets or sets the message id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the observation. /// [Key("observation")] public CultNetSimulationObservation Observation { get; set; } = new CultNetSimulationObservation(); } /// /// Carries one deterministic consensus candidate derived from witness observations. /// [MessagePackObject] public class CultNetSimulationConsensusCandidateMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.SimulationConsensusCandidate; /// /// Gets or sets the message id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the shard id. /// [Key("shardId")] public string ShardId { get; set; } = string.Empty; /// /// Gets or sets the shard epoch. /// [Key("shardEpoch")] public long ShardEpoch { get; set; } /// /// Gets or sets the simulation frame. /// [Key("frame")] public long Frame { get; set; } /// /// Gets or sets the subject id. /// [Key("subjectId")] public string SubjectId { get; set; } = string.Empty; /// /// Gets or sets the claim kind. /// [Key("claimKind")] public string ClaimKind { get; set; } = string.Empty; /// /// Gets or sets the selected claim hash. /// [Key("claimHash")] public string ClaimHash { get; set; } = string.Empty; /// /// Gets or sets optional claim detail. /// [Key("claimSummary")] public string? ClaimSummary { get; set; } /// /// Gets or sets distinct supporting witnesses. /// [Key("witnessCount")] public int WitnessCount { get; set; } /// /// Gets or sets supporting witness weight. /// [Key("supportWeight")] public double SupportWeight { get; set; } /// /// Gets or sets total observed witness weight. /// [Key("totalWeight")] public double TotalWeight { get; set; } /// /// Gets or sets whether the candidate crossed quorum. /// [Key("hasQuorum")] public bool HasQuorum { get; set; } /// /// Gets or sets support divided by total observed weight. /// [Key("confidence")] public double Confidence { get; set; } /// /// Creates a wire candidate message from a local candidate. /// public static CultNetSimulationConsensusCandidateMessage FromCandidate( string messageId, CultNetSimulationConsensusCandidate candidate) { if (candidate == null) throw new ArgumentNullException(nameof(candidate)); return new CultNetSimulationConsensusCandidateMessage { MessageId = string.IsNullOrWhiteSpace(messageId) ? Guid.NewGuid().ToString("N") : messageId, ShardId = candidate.ShardId, ShardEpoch = candidate.ShardEpoch, Frame = candidate.Frame, SubjectId = candidate.SubjectId, ClaimKind = candidate.ClaimKind, ClaimHash = candidate.ClaimHash, ClaimSummary = candidate.ClaimSummary, WitnessCount = candidate.WitnessCount, SupportWeight = candidate.SupportWeight, TotalWeight = candidate.TotalWeight, HasQuorum = candidate.HasQuorum, Confidence = candidate.Confidence }; } } /// /// Describes one schema exposed through the CultNet schema catalog. /// [MessagePackObject] public class CultNetSchemaDescriptor { /// /// Gets or sets the schema id. /// [Key("schemaId")] public string SchemaId { get; set; } = string.Empty; /// /// Gets or sets the kind. /// [Key("kind")] public string Kind { get; set; } = string.Empty; /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string? SchemaVersion { get; set; } /// /// Gets or sets the document type. /// [Key("documentType")] public string? DocumentType { get; set; } /// /// Gets or sets the title. /// [Key("title")] public string? Title { get; set; } /// /// Gets or sets the wire contracts. /// [Key("wireContracts")] public string[] WireContracts { get; set; } = Array.Empty(); /// /// Gets or sets the content hash. /// [Key("contentHash")] public string ContentHash { get; set; } = string.Empty; /// /// Gets or sets the schema json. /// [Key("schemaJson")] public string? SchemaJson { get; set; } } /// /// CultNet message requesting schema catalog entries. /// [MessagePackObject] public class CultNetSchemaCatalogRequestMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.SchemaCatalogRequest; /// /// Gets or sets the message id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the include schema json. /// [Key("includeSchemaJson")] public bool IncludeSchemaJson { get; set; } /// /// Gets or sets the schema ids. /// [Key("schemaIds")] public string[]? SchemaIds { get; set; } /// /// Gets or sets the kinds. /// [Key("kinds")] public string[]? Kinds { get; set; } } /// /// CultNet message returning schema catalog entries. /// [MessagePackObject] public class CultNetSchemaCatalogResponseMessage : ICultNetSchemaMessage { /// /// Gets or sets the schema version. /// [Key("schemaVersion")] public string SchemaVersion { get; set; } = CultNetSchemaVersions.SchemaCatalogResponse; /// /// Gets or sets the message id. /// [Key("messageId")] public string MessageId { get; set; } = string.Empty; /// /// Gets or sets the schemas. /// [Key("schemas")] public CultNetSchemaDescriptor[] Schemas { get; set; } = Array.Empty(); } }