#pragma once

#include <array>
#include <cstdint>
#include <cstdlib>
#include <string>

namespace frostbite2D {

class UUID {
public:
  static UUID generate();
  static UUID fromString(const std::string& str);
  std::string toString() const;

  UUID() = default;

  bool operator==(const UUID& other) const { return data_ == other.data_; }
  bool operator!=(const UUID& other) const { return data_ != other.data_; }

  bool isValid() const {
    for (auto byte : data_) {
      if (byte != 0) return true;
    }
    return false;
  }

  const std::array<uint8_t, 16>& data() const { return data_; }

private:
  explicit UUID(const std::array<uint8_t, 16>& data) : data_(data) {}

  std::array<uint8_t, 16> data_{};
};

} // namespace frostbite2D
