refactor: replace SpaceLayerKinds with strongly-typed SpaceLayerKind enum
Replaces string-based `SpaceLayerKinds` constants with a strongly-typed `SpaceLayerKind` enum. Updates backend services, runtime models, and projection logic to use the new enum. Adds `ToContractValue` method for compatibility with existing contracts.
This commit is contained in:
@@ -86,12 +86,12 @@ public enum ShipState
|
||||
Fleeing,
|
||||
}
|
||||
|
||||
public static class SpaceLayerKinds
|
||||
public enum SpaceLayerKind
|
||||
{
|
||||
public const string UniverseSpace = "universe-space";
|
||||
public const string GalaxySpace = "galaxy-space";
|
||||
public const string SystemSpace = "system-space";
|
||||
public const string LocalSpace = "local-space";
|
||||
UniverseSpace,
|
||||
GalaxySpace,
|
||||
SystemSpace,
|
||||
LocalSpace,
|
||||
}
|
||||
|
||||
public static class MovementRegimeKinds
|
||||
@@ -274,4 +274,13 @@ public static class SimulationEnumMappings
|
||||
ShipState.Fleeing => "fleeing",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(state), state, null),
|
||||
};
|
||||
|
||||
public static string ToContractValue(this SpaceLayerKind kind) => kind switch
|
||||
{
|
||||
SpaceLayerKind.UniverseSpace => "universe-space",
|
||||
SpaceLayerKind.GalaxySpace => "galaxy-space",
|
||||
SpaceLayerKind.SystemSpace => "system-space",
|
||||
SpaceLayerKind.LocalSpace => "local-space",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(kind), kind, null),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user