#ifndef VERSION_HPP_
#define VERSION_HPP_

#include <cstdint>
#include <iostream>
#include <optional>

/**
 * @brief Represents a version number.
 * 
 * Examples of construction:
 * 
 * ```
 * Version version{1, 2, 3};            // 1.2.3
 * ```
 */
struct Version
{
    uint8_t major;
    uint8_t minor;
    uint8_t patchLevel;

    /**
     * @brief The version of this build.
     * 
     * This is used wherever the version is displayed, as well as to compare versions
     * when connecting to a server. In non-standard builds, this is set to the zero
     * version (0.0.0).
     */
    static Version ofThisBuild;

    static std::optional<Version> fromString(const std::string &versionString);

    operator bool();
    bool operator!();
    bool operator==(const Version &other) const;
    bool operator<(const Version &other) const;
    bool operator>(const Version &other) const;
    bool operator<=(const Version &other) const;
    bool operator>=(const Version &other) const;
};

std::ostream& operator<<(std::ostream &os, const Version &version);

#endif