class_name GameVersion
extends RefCounted
## Single source of truth for the game's version string.
##
## The numeric version lives in project.godot (application/config/version) so it
## also feeds export metadata; here we read it back and layer on the pre-release
## CHANNEL and a human-readable STAGE label. We're pre-1.0 — every 0.x build is
## understood to be unstable, in-development software (see the recommendations in
## the commit / PR notes for why 0.x is the convention for early game dev).

## Pre-release channel appended to the number, SemVer-style (e.g. 0.1.0-alpha).
const CHANNEL: String = "alpha"

## Friendly stage banner shown to players so it's unmistakably an early build.
const STAGE: String = "Early Development Build"


## Bare numeric version, e.g. "0.1.0". Read from project settings.
static func number() -> String:
	return str(ProjectSettings.get_setting("application/config/version", "0.0.0"))


## Full version tag, e.g. "v0.1.0-alpha".
static func string() -> String:
	var s := "v" + number()
	if not CHANNEL.is_empty():
		s += "-" + CHANNEL
	return s


## Version tag + stage banner, e.g. "v0.1.0-alpha · Early Development Build".
static func full() -> String:
	return "%s · %s" % [string(), STAGE]
