323 lines
9.1 KiB
Go
323 lines
9.1 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type SCUMObservationStatus string
|
|
|
|
const (
|
|
SCUMObservationAccepted SCUMObservationStatus = "accepted"
|
|
SCUMObservationStale SCUMObservationStatus = "stale"
|
|
SCUMObservationFailed SCUMObservationStatus = "failed"
|
|
)
|
|
|
|
type SCUMProjectionFreshness string
|
|
|
|
const (
|
|
SCUMProjectionFresh SCUMProjectionFreshness = "fresh"
|
|
SCUMProjectionStale SCUMProjectionFreshness = "stale"
|
|
SCUMProjectionUnknown SCUMProjectionFreshness = "unknown"
|
|
)
|
|
|
|
type SCUMWorkflowStatus string
|
|
|
|
const (
|
|
SCUMWorkflowDraft SCUMWorkflowStatus = "draft"
|
|
SCUMWorkflowQueued SCUMWorkflowStatus = "queued"
|
|
SCUMWorkflowRunning SCUMWorkflowStatus = "running"
|
|
SCUMWorkflowWaiting SCUMWorkflowStatus = "waiting"
|
|
SCUMWorkflowBlocked SCUMWorkflowStatus = "blocked"
|
|
SCUMWorkflowConfirming SCUMWorkflowStatus = "confirming"
|
|
SCUMWorkflowConfirmed SCUMWorkflowStatus = "confirmed"
|
|
SCUMWorkflowFailed SCUMWorkflowStatus = "failed"
|
|
SCUMWorkflowUnknown SCUMWorkflowStatus = "unknown"
|
|
SCUMWorkflowCancelled SCUMWorkflowStatus = "cancelled"
|
|
)
|
|
|
|
type SCUMWorkflowStepStatus string
|
|
|
|
const (
|
|
SCUMWorkflowStepQueued SCUMWorkflowStepStatus = "queued"
|
|
SCUMWorkflowStepRunning SCUMWorkflowStepStatus = "running"
|
|
SCUMWorkflowStepWaiting SCUMWorkflowStepStatus = "waiting"
|
|
SCUMWorkflowStepBlocked SCUMWorkflowStepStatus = "blocked"
|
|
SCUMWorkflowStepConfirming SCUMWorkflowStepStatus = "confirming"
|
|
SCUMWorkflowStepConfirmed SCUMWorkflowStepStatus = "confirmed"
|
|
SCUMWorkflowStepFailed SCUMWorkflowStepStatus = "failed"
|
|
SCUMWorkflowStepUnknown SCUMWorkflowStepStatus = "unknown"
|
|
SCUMWorkflowStepCancelled SCUMWorkflowStepStatus = "cancelled"
|
|
)
|
|
|
|
type SCUMSafeSummary struct {
|
|
Title string
|
|
Message string
|
|
Details map[string]string
|
|
}
|
|
|
|
type SCUMDataObservation struct {
|
|
ID string
|
|
ServerInstanceID string
|
|
PluginID string
|
|
Source string
|
|
QueryKey string
|
|
SubjectType string
|
|
SubjectID string
|
|
Sequence uint64
|
|
Checksum string
|
|
Status SCUMObservationStatus
|
|
ErrorCode string
|
|
SafeSummary SCUMSafeSummary
|
|
ObservedAt time.Time
|
|
ReceivedAt time.Time
|
|
}
|
|
|
|
type SCUMObservationResult struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
Source string
|
|
QueryKey string
|
|
Sequence uint64
|
|
Checksum string
|
|
Status SCUMObservationStatus
|
|
ErrorCode string
|
|
SafeSummary SCUMSafeSummary
|
|
ObservedAt time.Time
|
|
ReceivedAt time.Time
|
|
Rows []map[string]any
|
|
}
|
|
|
|
type SCUMDataSet string
|
|
|
|
const (
|
|
SCUMDataSetUsers SCUMDataSet = "scum_users"
|
|
SCUMDataSetSquads SCUMDataSet = "scum_squads"
|
|
SCUMDataSetMembers SCUMDataSet = "scum_squad_members"
|
|
SCUMDataSetVehicles SCUMDataSet = "scum_vehicles"
|
|
SCUMDataSetFlags SCUMDataSet = "scum_flags"
|
|
SCUMDataSetActivity SCUMDataSet = "scum_activity_events"
|
|
SCUMDataSetGifts SCUMDataSet = "scum_gift_catalogs"
|
|
SCUMDataSetMapPoints SCUMDataSet = "scum_map_points"
|
|
)
|
|
|
|
type SCUMDataRow struct {
|
|
ID string
|
|
ServerInstanceID string
|
|
TargetTable SCUMDataSet
|
|
UpsertKey string
|
|
Fields map[string]any
|
|
Payload map[string]any
|
|
PluginID string
|
|
QueryKey string
|
|
Freshness SCUMProjectionFreshnessState
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type SCUMProjectionFreshnessState struct {
|
|
Status SCUMProjectionFreshness
|
|
ObservationID string
|
|
Source string
|
|
QueryKey string
|
|
Sequence uint64
|
|
Checksum string
|
|
StaleReason string
|
|
ObservedAt time.Time
|
|
ReceivedAt time.Time
|
|
}
|
|
|
|
type SCUMMutationGuard struct {
|
|
FieldKey string
|
|
Before any
|
|
After any
|
|
MaxRowsAffected int
|
|
SafetyWindow string
|
|
BackupRef string
|
|
RequiresOfflinePlayer bool
|
|
RequiresMaintenance bool
|
|
RequiresBackup bool
|
|
}
|
|
|
|
type SCUMOperationConfirmation struct {
|
|
Status string
|
|
ObservationID string
|
|
ConfirmedFields map[string]any
|
|
AffectedRows int
|
|
MutationChecksum string
|
|
Checksum string
|
|
ObservedAt time.Time
|
|
SafeSummary SCUMSafeSummary
|
|
}
|
|
|
|
type SCUMOperationRequest struct {
|
|
ID string
|
|
ServerInstanceID string
|
|
PluginID string
|
|
TemplateKey string
|
|
PlayerID string
|
|
RequesterID string
|
|
ApproverID string
|
|
ApprovalLevel GameClientBridgeApprovalLevel
|
|
Payload map[string]any
|
|
Guard SCUMMutationGuard
|
|
Confirmation SCUMOperationConfirmation
|
|
Status SCUMWorkflowStepStatus
|
|
Reason string
|
|
IdempotencyKey string
|
|
RunJobID string
|
|
SafeSummary SCUMSafeSummary
|
|
AuditReferences []string
|
|
CreatedAt time.Time
|
|
ApprovedAt time.Time
|
|
CompletedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type SCUMOperationRequestFilter struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
TemplateKey string
|
|
PlayerID string
|
|
RequesterID string
|
|
Status SCUMWorkflowStepStatus
|
|
IdempotencyKey string
|
|
Limit int
|
|
}
|
|
|
|
type SCUMWorkflowInstanceFilter struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
TemplateKey string
|
|
RequestedBy string
|
|
Status SCUMWorkflowStatus
|
|
IdempotencyKey string
|
|
Limit int
|
|
}
|
|
|
|
type SCUMWorkflowStepFilter struct {
|
|
WorkflowID string
|
|
ServerInstanceID string
|
|
StepKey string
|
|
Status SCUMWorkflowStepStatus
|
|
MutatesState *bool
|
|
Limit int
|
|
}
|
|
|
|
type SCUMWorkflowInstance struct {
|
|
ID string
|
|
ServerInstanceID string
|
|
PluginID string
|
|
TemplateKey string
|
|
RequestedBy string
|
|
IdempotencyKey string
|
|
Status SCUMWorkflowStatus
|
|
CurrentStepKey string
|
|
Input map[string]any
|
|
SafeSummary SCUMSafeSummary
|
|
BlockerReason string
|
|
AuditReferences []string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
CompletedAt time.Time
|
|
}
|
|
|
|
type SCUMWorkflowStep struct {
|
|
ID string
|
|
WorkflowID string
|
|
ServerInstanceID string
|
|
StepKey string
|
|
DependsOn []string
|
|
Status SCUMWorkflowStepStatus
|
|
OperationKey string
|
|
QueryTemplateKey string
|
|
Capability string
|
|
TargetKey string
|
|
JobID string
|
|
Attempt int
|
|
MaxAttempts int
|
|
MutatesState bool
|
|
Confirmation SCUMOperationConfirmation
|
|
SafeSummary SCUMSafeSummary
|
|
BlockerReason string
|
|
AuditReferences []string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
CompletedAt time.Time
|
|
}
|
|
|
|
func CopySCUMSafeSummary(value SCUMSafeSummary) SCUMSafeSummary {
|
|
value.Details = CopyStringMap(value.Details)
|
|
return value
|
|
}
|
|
|
|
func CopySCUMDataObservation(value SCUMDataObservation) SCUMDataObservation {
|
|
value.SafeSummary = CopySCUMSafeSummary(value.SafeSummary)
|
|
return value
|
|
}
|
|
|
|
func CopySCUMObservationResult(value SCUMObservationResult) SCUMObservationResult {
|
|
value.SafeSummary = CopySCUMSafeSummary(value.SafeSummary)
|
|
value.Rows = CopyGameClientBridgeRows(value.Rows)
|
|
return value
|
|
}
|
|
|
|
func CopySCUMRowTargetDeclaration(value SCUMRowTargetDeclaration) SCUMRowTargetDeclaration {
|
|
value.UpsertKeys = CopyStringSlice(value.UpsertKeys)
|
|
value.ColumnMappings = CopyStringMap(value.ColumnMappings)
|
|
return value
|
|
}
|
|
|
|
func CopySCUMDataRow(value SCUMDataRow) SCUMDataRow {
|
|
value.Fields = CopyGameClientBridgePayload(value.Fields)
|
|
value.Payload = CopyGameClientBridgePayload(value.Payload)
|
|
value.Freshness = CopySCUMProjectionFreshnessState(value.Freshness)
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeRows(values []map[string]any) []map[string]any {
|
|
if values == nil {
|
|
return nil
|
|
}
|
|
out := make([]map[string]any, len(values))
|
|
for index, row := range values {
|
|
out[index] = CopyGameClientBridgePayload(row)
|
|
}
|
|
return out
|
|
}
|
|
|
|
func CopySCUMProjectionFreshnessState(value SCUMProjectionFreshnessState) SCUMProjectionFreshnessState {
|
|
return value
|
|
}
|
|
|
|
func CopySCUMMutationGuard(value SCUMMutationGuard) SCUMMutationGuard {
|
|
return value
|
|
}
|
|
|
|
func CopySCUMOperationConfirmation(value SCUMOperationConfirmation) SCUMOperationConfirmation {
|
|
value.ConfirmedFields = CopyGameClientBridgePayload(value.ConfirmedFields)
|
|
value.SafeSummary = CopySCUMSafeSummary(value.SafeSummary)
|
|
return value
|
|
}
|
|
|
|
func CopySCUMOperationRequest(value SCUMOperationRequest) SCUMOperationRequest {
|
|
value.Payload = CopyGameClientBridgePayload(value.Payload)
|
|
value.Guard = CopySCUMMutationGuard(value.Guard)
|
|
value.Confirmation = CopySCUMOperationConfirmation(value.Confirmation)
|
|
value.SafeSummary = CopySCUMSafeSummary(value.SafeSummary)
|
|
value.AuditReferences = CopyStringSlice(value.AuditReferences)
|
|
return value
|
|
}
|
|
|
|
func CopySCUMWorkflowInstance(value SCUMWorkflowInstance) SCUMWorkflowInstance {
|
|
value.Input = CopyGameClientBridgePayload(value.Input)
|
|
value.SafeSummary = CopySCUMSafeSummary(value.SafeSummary)
|
|
value.AuditReferences = CopyStringSlice(value.AuditReferences)
|
|
return value
|
|
}
|
|
|
|
func CopySCUMWorkflowStep(value SCUMWorkflowStep) SCUMWorkflowStep {
|
|
value.DependsOn = CopyStringSlice(value.DependsOn)
|
|
value.Confirmation = CopySCUMOperationConfirmation(value.Confirmation)
|
|
value.SafeSummary = CopySCUMSafeSummary(value.SafeSummary)
|
|
value.AuditReferences = CopyStringSlice(value.AuditReferences)
|
|
return value
|
|
}
|