Files
open-wc/src/domain/identity/server_entry_id.gd
T
sindoring c1dc07c705 feat(M01): add typed domain identities
Work-Package: M01-FND-DOMAIN-IDENTITIES-001

Agent: sindo-main-codex
2026-07-13 16:11:00 +04:00

42 lines
1.2 KiB
GDScript

class_name ServerEntryId
extends RefCounted
## Adapter-namespaced numeric entry from a server database or canonical snapshot.
## Equal numbers in different template tables are intentionally different IDs.
var entry_namespace: String:
get:
return _entry_namespace
var entry_value: int:
get:
return _entry_value
var _entry_namespace: String
var _entry_value: int
## Normalizes a table/adapter namespace and preserves its positive entry value.
func _init(entry_namespace_value: String, entry_value_value: int) -> void:
_entry_namespace = entry_namespace_value.strip_edges().to_lower()
_entry_value = entry_value_value
## Reports whether both collision-prevention fields are present.
func is_valid() -> bool:
return not _entry_namespace.is_empty() and _entry_value > 0
## Compares both namespace and numeric entry.
func equals(other_server_entry_id: ServerEntryId) -> bool:
return (
other_server_entry_id != null
and _entry_namespace == other_server_entry_id.entry_namespace
and _entry_value == other_server_entry_id.entry_value
)
## Returns the stable adapter key without implying a ContentId mapping.
func to_key() -> String:
return "%s:%d" % [_entry_namespace, _entry_value]