class_name LogLocation
extends RefCounted
## A canon-log location row: id (code key) + name (prose).

var id: String
var name: String


func _init(p_id := "", p_name := "") -> void:
	if p_id != "" and not Ids.is_valid(p_id):
		push_error("invalid location id: %s" % p_id)
	id = p_id
	name = p_name


func to_dict() -> Dictionary:
	return {"id": id, "name": name}


static func from_dict(d: Dictionary) -> LogLocation:
	return LogLocation.new(d.get("id", ""), d.get("name", ""))
