/**
 * Faction value type — a named group that characters can belong to.
 *
 * Invariant: faction names are non-empty trimmed strings.
 */
export class Faction {
  #value: string;

  private constructor(value: string) {
    this.#value = value;
  }

  static create(value: string): Faction {
    const trimmed = value.trim();
    if (trimmed.length === 0) {
      throw new Error('Faction name cannot be empty');
    }
    return new Faction(trimmed);
  }

  get value(): string {
    return this.#value;
  }

  toString(): string {
    return `Faction(${this.#value})`;
  }
}
