#pragma once
#include <whiteout/common_types.h>
#include <array>
#include <span>
#include <string>
#include <vector>
namespace whiteout::storages::casc {
struct BuildInfo {
std::string branch;
bool active = false;
std::array<u8, 16> buildKey{};
std::array<u8, 16> cdnKey{};
std::string cdnPath;
std::string version;
std::string product;
};
std::vector<BuildInfo> parseBuildInfo(std::span<const u8> data);
std::string parseFlavorInfo(std::span<const u8> data);
struct BuildConfig {
std::array<u8, 16> rootCKey{};
std::array<u8, 16> encodingCKey{};
std::array<u8, 16> encodingEKey{};
u64 encodingSize = 0;
std::array<u8, 16> downloadCKey{};
std::array<u8, 16> installCKey{};
std::string buildName;
std::string buildProduct;
std::string buildUid;
std::array<u8, 16> vfsRootCKey{};
std::array<u8, 16> vfsRootEKey{};
struct VfsManifest {
std::array<u8, 16> cKey{};
std::array<u8, 16> eKey{};
};
std::vector<VfsManifest> vfsSubManifests;
};
BuildConfig parseBuildConfig(std::span<const u8> data);
struct CdnConfig {
std::vector<std::array<u8, 16>> archiveEKeys;
std::vector<u32> archiveIndexSizes;
std::string fileIndex;
u32 fileIndexSize = 0;
};
CdnConfig parseCdnConfig(std::span<const u8> data);
struct ShmemInfo {
u32 archiveCount = 0;
u32 version = 0;
};
ShmemInfo parseShmem(std::span<const u8> data);
struct TsvTable {
std::vector<std::string> columns;
std::vector<std::vector<std::string>> rows;
};
TsvTable parseTsv(std::span<const u8> data);
struct VersionInfo {
std::string region;
std::array<u8, 16> buildConfigKey{};
std::array<u8, 16> cdnConfigKey{};
std::array<u8, 16> keyRing{};
u32 buildId = 0;
std::string versionName;
std::string productConfig;
};
struct CdnInfo {
std::string region;
std::string path;
std::vector<std::string> hosts;
std::string configPath;
};
std::vector<VersionInfo> parseVersionsResponse(std::span<const u8> data);
std::vector<CdnInfo> parseCdnsResponse(std::span<const u8> data);
}