BareGit
#pragma once

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

/// Persisted components from which a public card ID is derived.
struct CardIdentity
{
    /// Lowercase database game short name, or null for a loose card.
    std::optional<std::string> game_short_name;

    /// Sequential game number or random loose-card number.
    std::uint64_t card_number;
};

/// Common persisted and asset metadata for one card.
struct Card
{
    /// Internal SQLite primary key, or zero before insertion.
    std::int64_t id;

    /// Persisted components of the card's public identity.
    CardIdentity identity;

    /// Human-readable card name.
    std::string name;

    /// Optional short Markdown description.
    std::optional<std::string> short_description;

    /// Optional long Markdown description.
    std::optional<std::string> long_description;

    /// Nonnegative rarity value.
    std::int64_t rarity;

    /// Stored front-art filename extension.
    std::string front_extension;

    /// Stored foil-control filename extension, when present.
    std::optional<std::string> foil_extension;

    /// Stored thumbnail filename extension.
    std::string thumbnail_extension;

    /// Optimistic-concurrency and asset-cache revision.
    std::int64_t revision;

    /// Internal user ID of the account that created this card.
    std::int64_t creator_user_id = 0;
};

/// Logical card image used consistently by validation, storage, and URLs.
enum class CardAssetType
{
    /// Full-size front artwork.
    FRONT_ART,

    /// Optional foil-control texture.
    FOIL_CONTROL,

    /// Static card-index thumbnail.
    THUMBNAIL
};