Files
space-game/apps/backend/PlayerFaction/Runtime/PlayerFactionRuntimeModels.cs

309 lines
14 KiB
C#

using static SpaceGame.Api.Shared.Runtime.ShipBehaviorKinds;
namespace SpaceGame.Api.PlayerFaction.Runtime;
public sealed class PlayerFactionRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public required string SovereignFactionId { get; set; }
public string Status { get; set; } = "active";
public DateTimeOffset CreatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
public PlayerAssetRegistryRuntime AssetRegistry { get; set; } = new();
public PlayerStrategicIntentRuntime StrategicIntent { get; set; } = new();
public List<PlayerFleetRuntime> Fleets { get; } = [];
public List<PlayerTaskForceRuntime> TaskForces { get; } = [];
public List<PlayerStationGroupRuntime> StationGroups { get; } = [];
public List<PlayerEconomicRegionRuntime> EconomicRegions { get; } = [];
public List<PlayerFrontRuntime> Fronts { get; } = [];
public List<PlayerReserveGroupRuntime> Reserves { get; } = [];
public List<PlayerFactionPolicyRuntime> Policies { get; } = [];
public List<PlayerAutomationPolicyRuntime> AutomationPolicies { get; } = [];
public List<PlayerReinforcementPolicyRuntime> ReinforcementPolicies { get; } = [];
public List<PlayerProductionProgramRuntime> ProductionPrograms { get; } = [];
public List<PlayerDirectiveRuntime> Directives { get; } = [];
public List<PlayerAssignmentRuntime> Assignments { get; } = [];
public List<PlayerDecisionLogEntryRuntime> DecisionLog { get; } = [];
public List<PlayerAlertRuntime> Alerts { get; } = [];
public string LastDeltaSignature { get; set; } = string.Empty;
}
public sealed class PlayerAssetRegistryRuntime
{
public HashSet<string> ShipIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> StationIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> CommanderIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> ClaimIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> ConstructionSiteIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> PolicySetIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> MarketOrderIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> FleetIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> TaskForceIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> StationGroupIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> EconomicRegionIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> FrontIds { get; } = new(StringComparer.Ordinal);
public HashSet<string> ReserveIds { get; } = new(StringComparer.Ordinal);
}
public sealed class PlayerStrategicIntentRuntime
{
public string StrategicPosture { get; set; } = "balanced";
public string EconomicPosture { get; set; } = "delegated";
public string MilitaryPosture { get; set; } = "layered-defense";
public string LogisticsPosture { get; set; } = "stable";
public float DesiredReserveRatio { get; set; } = 0.2f;
public bool AllowDelegatedCombatAutomation { get; set; } = true;
public bool AllowDelegatedEconomicAutomation { get; set; } = true;
public string? Notes { get; set; }
}
public sealed class PlayerFleetRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string Status { get; set; } = "active";
public string Role { get; set; } = "general-purpose";
public string? CommanderId { get; set; }
public string? FrontId { get; set; }
public string? HomeSystemId { get; set; }
public string? HomeStationId { get; set; }
public string? PolicyId { get; set; }
public string? AutomationPolicyId { get; set; }
public string? ReinforcementPolicyId { get; set; }
public List<string> AssetIds { get; } = [];
public List<string> TaskForceIds { get; } = [];
public List<string> DirectiveIds { get; } = [];
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerTaskForceRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string Status { get; set; } = "active";
public string Role { get; set; } = "task-force";
public string? FleetId { get; set; }
public string? CommanderId { get; set; }
public string? FrontId { get; set; }
public string? PolicyId { get; set; }
public string? AutomationPolicyId { get; set; }
public List<string> AssetIds { get; } = [];
public List<string> DirectiveIds { get; } = [];
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerStationGroupRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string Status { get; set; } = "active";
public string Role { get; set; } = "industrial-group";
public string? EconomicRegionId { get; set; }
public string? PolicyId { get; set; }
public string? AutomationPolicyId { get; set; }
public List<string> StationIds { get; } = [];
public List<string> DirectiveIds { get; } = [];
public List<string> FocusItemIds { get; } = [];
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerEconomicRegionRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string Status { get; set; } = "active";
public string Role { get; set; } = "balanced-region";
public string? SharedEconomicRegionId { get; set; }
public string? PolicyId { get; set; }
public string? AutomationPolicyId { get; set; }
public List<string> SystemIds { get; } = [];
public List<string> StationGroupIds { get; } = [];
public List<string> DirectiveIds { get; } = [];
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerFrontRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string Status { get; set; } = "active";
public float Priority { get; set; } = 50f;
public string Posture { get; set; } = "hold";
public string? SharedFrontLineId { get; set; }
public string? TargetFactionId { get; set; }
public List<string> SystemIds { get; } = [];
public List<string> FleetIds { get; } = [];
public List<string> ReserveIds { get; } = [];
public List<string> DirectiveIds { get; } = [];
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerReserveGroupRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string Status { get; set; } = "ready";
public string ReserveKind { get; set; } = "military";
public string? HomeSystemId { get; set; }
public string? PolicyId { get; set; }
public List<string> AssetIds { get; } = [];
public List<string> FrontIds { get; } = [];
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerFactionPolicyRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string ScopeKind { get; set; } = "player-faction";
public string? ScopeId { get; set; }
public string? PolicySetId { get; set; }
public bool AllowDelegatedCombat { get; set; } = true;
public bool AllowDelegatedTrade { get; set; } = true;
public float ReserveCreditsRatio { get; set; } = 0.2f;
public float ReserveMilitaryRatio { get; set; } = 0.2f;
public string TradeAccessPolicy { get; set; } = "owner-and-allies";
public string DockingAccessPolicy { get; set; } = "owner-and-allies";
public string ConstructionAccessPolicy { get; set; } = "owner-only";
public string OperationalRangePolicy { get; set; } = "unrestricted";
public string CombatEngagementPolicy { get; set; } = "defensive";
public bool AvoidHostileSystems { get; set; } = true;
public float FleeHullRatio { get; set; } = 0.35f;
public HashSet<string> BlacklistedSystemIds { get; } = new(StringComparer.Ordinal);
public string? Notes { get; set; }
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerAutomationPolicyRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string ScopeKind { get; set; } = "player-faction";
public string? ScopeId { get; set; }
public bool Enabled { get; set; } = true;
public string BehaviorKind { get; set; } = Idle;
public bool UseOrders { get; set; }
public string? StagingOrderKind { get; set; }
public int MaxSystemRange { get; set; }
public bool KnownStationsOnly { get; set; }
public float Radius { get; set; } = 24f;
public float WaitSeconds { get; set; } = 3f;
public string? PreferredItemId { get; set; }
public string? Notes { get; set; }
public List<ShipOrderTemplateRuntime> RepeatOrders { get; } = [];
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerReinforcementPolicyRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string ScopeKind { get; set; } = "player-faction";
public string? ScopeId { get; set; }
public string ShipKind { get; set; } = "military";
public int DesiredAssetCount { get; set; }
public int MinimumReserveCount { get; set; }
public bool AutoTransferReserves { get; set; } = true;
public bool AutoQueueProduction { get; set; } = true;
public string? SourceReserveId { get; set; }
public string? TargetFrontId { get; set; }
public string? Notes { get; set; }
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerProductionProgramRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string Status { get; set; } = "active";
public string Kind { get; set; } = "ship-production";
public string? TargetShipKind { get; set; }
public string? TargetModuleId { get; set; }
public string? TargetItemId { get; set; }
public int TargetCount { get; set; }
public int CurrentCount { get; set; }
public string? StationGroupId { get; set; }
public string? ReinforcementPolicyId { get; set; }
public string? Notes { get; set; }
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerDirectiveRuntime
{
public required string Id { get; init; }
public required string Label { get; set; }
public string Status { get; set; } = "active";
public string Kind { get; set; } = "hold";
public string ScopeKind { get; set; } = "asset";
public string ScopeId { get; set; } = string.Empty;
public string? TargetEntityId { get; set; }
public string? TargetSystemId { get; set; }
public Vector3? TargetPosition { get; set; }
public string? HomeSystemId { get; set; }
public string? HomeStationId { get; set; }
public string? SourceStationId { get; set; }
public string? DestinationStationId { get; set; }
public string BehaviorKind { get; set; } = Idle;
public bool UseOrders { get; set; }
public string? StagingOrderKind { get; set; }
public string? ItemId { get; set; }
public string? PreferredNodeId { get; set; }
public string? PreferredConstructionSiteId { get; set; }
public string? PreferredModuleId { get; set; }
public int Priority { get; set; } = 50;
public float Radius { get; set; } = 24f;
public float WaitSeconds { get; set; } = 3f;
public int MaxSystemRange { get; set; }
public bool KnownStationsOnly { get; set; }
public List<Vector3> PatrolPoints { get; } = [];
public List<ShipOrderTemplateRuntime> RepeatOrders { get; } = [];
public string? PolicyId { get; set; }
public string? AutomationPolicyId { get; set; }
public string? Notes { get; set; }
public DateTimeOffset CreatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerAssignmentRuntime
{
public required string Id { get; init; }
public required string AssetKind { get; set; }
public required string AssetId { get; set; }
public string? FleetId { get; set; }
public string? TaskForceId { get; set; }
public string? StationGroupId { get; set; }
public string? EconomicRegionId { get; set; }
public string? FrontId { get; set; }
public string? ReserveId { get; set; }
public string? DirectiveId { get; set; }
public string? PolicyId { get; set; }
public string? AutomationPolicyId { get; set; }
public string Role { get; set; } = "line";
public string Status { get; set; } = "active";
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerDecisionLogEntryRuntime
{
public required string Id { get; init; }
public required string Kind { get; set; }
public required string Summary { get; set; }
public string? RelatedEntityKind { get; set; }
public string? RelatedEntityId { get; set; }
public DateTimeOffset OccurredAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class PlayerAlertRuntime
{
public required string Id { get; init; }
public required string Kind { get; set; }
public required string Severity { get; set; }
public required string Summary { get; set; }
public string? AssetKind { get; set; }
public string? AssetId { get; set; }
public string? RelatedDirectiveId { get; set; }
public string Status { get; set; } = "open";
public DateTimeOffset CreatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}