export class VersionCode {
  private constructor(private readonly _value: number) {}

  static create(value: number): VersionCode {
    if (!Number.isInteger(value) || value < 1) {
      throw new Error('Version code must be a positive integer')
    }
    return new VersionCode(value)
  }

  get value(): number {
    return this._value
  }

  isNewerThan(other: VersionCode): boolean {
    return this._value > other._value
  }

  equals(other: VersionCode): boolean {
    return this._value === other._value
  }
}
