BareGit
#pragma once

#include <cstdint>
#include <optional>
#include <string>

/// Permission level assigned to one user account.
enum class UserRole
{
    PLAYER = 0,
    CREATOR = 1,
    ADMINISTRATOR = 2
};

/// Persisted application user and lazily accrued pull state.
struct User
{
    /// Internal SQLite identity.
    std::int64_t id;

    /// Immutable validated delivery address.
    std::string email;

    /// Normalized unique email identity.
    std::string email_key;

    /// NFC username, or null until onboarding completes.
    std::optional<std::string> username;

    /// Current permission level.
    UserRole role;

    /// Pulls retained at the last refresh.
    std::uint32_t stored_pulls;

    /// UTC epoch day at the last refresh.
    std::int64_t pull_refresh_day;

    /// Unix timestamp at account creation.
    std::int64_t created_at;
};