// This file is generated by tools/codegen.sh
// DO NOT EDIT IT.

// clang-format off

//  To parse this JSON data, first install
//
//      json.hpp  https://github.com/nlohmann/json
//
//  Then include this file, and then do
//
//     Generators.hpp data = nlohmann::json::parse(jsonString);

#pragma once

#include <optional>
#include <nlohmann/json.hpp>
#include "linglong/api/types/v1/helper.hpp"

#include "linglong/api/types/v1/LinglongAPIV1.hpp"
#include "linglong/api/types/v1/UpgradeListResult.hpp"
#include "linglong/api/types/v1/UabMetaInfo.hpp"
#include "linglong/api/types/v1/Version.hpp"
#include "linglong/api/types/v1/Sections.hpp"
#include "linglong/api/types/v1/UabLayer.hpp"
#include "linglong/api/types/v1/SubState.hpp"
#include "linglong/api/types/v1/State.hpp"
#include "linglong/api/types/v1/RepositoryCache.hpp"
#include "linglong/api/types/v1/RepositoryCacheMergedItem.hpp"
#include "linglong/api/types/v1/RepositoryCacheLayersItem.hpp"
#include "linglong/api/types/v1/RepoConfigV2.hpp"
#include "linglong/api/types/v1/RepoConfig.hpp"
#include "linglong/api/types/v1/Repo.hpp"
#include "linglong/api/types/v1/PackageManager1UpdateParameters.hpp"
#include "linglong/api/types/v1/PackageManager1UninstallParameters.hpp"
#include "linglong/api/types/v1/PackageManager1SearchResult.hpp"
#include "linglong/api/types/v1/PackageManager1SearchParameters.hpp"
#include "linglong/api/types/v1/PackageManager1RequestInteractionAdditionalMessage.hpp"
#include "linglong/api/types/v1/PackageManager1PruneResult.hpp"
#include "linglong/api/types/v1/PackageManager1PackageTaskResult.hpp"
#include "linglong/api/types/v1/PackageManager1Package.hpp"
#include "linglong/api/types/v1/PackageManager1ModifyRepoParameters.hpp"
#include "linglong/api/types/v1/PackageManager1JobInfo.hpp"
#include "linglong/api/types/v1/PackageManager1InstallParameters.hpp"
#include "linglong/api/types/v1/PackageManager1InstallParametersPacakge.hpp"
#include "linglong/api/types/v1/PackageManager1GetRepoInfoResult.hpp"
#include "linglong/api/types/v1/PackageManager1GetRepoInfoResultRepoInfo.hpp"
#include "linglong/api/types/v1/PackageInfoV2.hpp"
#include "linglong/api/types/v1/PackageInfoDisplay.hpp"
#include "linglong/api/types/v1/PackageInfo.hpp"
#include "linglong/api/types/v1/OciConfigurationPatch.hpp"
#include "linglong/api/types/v1/LayerInfo.hpp"
#include "linglong/api/types/v1/InteractionRequest.hpp"
#include "linglong/api/types/v1/InteractionReply.hpp"
#include "linglong/api/types/v1/InteractionMessageType.hpp"
#include "linglong/api/types/v1/InspectResult.hpp"
#include "linglong/api/types/v1/ExtensionImpl.hpp"
#include "linglong/api/types/v1/ExtensionDefine.hpp"
#include "linglong/api/types/v1/ExportDirs.hpp"
#include "linglong/api/types/v1/DialogMessage.hpp"
#include "linglong/api/types/v1/DialogHandShakePayload.hpp"
#include "linglong/api/types/v1/ContainerProcessStateInfo.hpp"
#include "linglong/api/types/v1/CommonResult.hpp"
#include "linglong/api/types/v1/CommonOptions.hpp"
#include "linglong/api/types/v1/CliContainer.hpp"
#include "linglong/api/types/v1/BuilderProject.hpp"
#include "linglong/api/types/v1/BuilderProjectSource.hpp"
#include "linglong/api/types/v1/BuilderProjectPackage.hpp"
#include "linglong/api/types/v1/BuilderProjectModules.hpp"
#include "linglong/api/types/v1/BuilderProjectBuildEXT.hpp"
#include "linglong/api/types/v1/Apt.hpp"
#include "linglong/api/types/v1/BuilderConfig.hpp"
#include "linglong/api/types/v1/ApplicationPermissionsRequest.hpp"
#include "linglong/api/types/v1/ApplicationConfiguration.hpp"
#include "linglong/api/types/v1/ApplicationConfigurationPermissions.hpp"
#include "linglong/api/types/v1/XdgDirectoryPermission.hpp"
#include "linglong/api/types/v1/ApplicationConfigurationPermissionsInnerBind.hpp"
#include "linglong/api/types/v1/ApplicationConfigurationPermissionsBind.hpp"

namespace linglong {
namespace api {
namespace types {
namespace v1 {
void from_json(const json & j, ApplicationConfigurationPermissionsBind & x);
void to_json(json & j, const ApplicationConfigurationPermissionsBind & x);

void from_json(const json & j, ApplicationConfigurationPermissionsInnerBind & x);
void to_json(json & j, const ApplicationConfigurationPermissionsInnerBind & x);

void from_json(const json & j, XdgDirectoryPermission & x);
void to_json(json & j, const XdgDirectoryPermission & x);

void from_json(const json & j, ApplicationConfigurationPermissions & x);
void to_json(json & j, const ApplicationConfigurationPermissions & x);

void from_json(const json & j, ApplicationConfiguration & x);
void to_json(json & j, const ApplicationConfiguration & x);

void from_json(const json & j, ApplicationPermissionsRequest & x);
void to_json(json & j, const ApplicationPermissionsRequest & x);

void from_json(const json & j, BuilderConfig & x);
void to_json(json & j, const BuilderConfig & x);

void from_json(const json & j, Apt & x);
void to_json(json & j, const Apt & x);

void from_json(const json & j, BuilderProjectBuildEXT & x);
void to_json(json & j, const BuilderProjectBuildEXT & x);

void from_json(const json & j, BuilderProjectModules & x);
void to_json(json & j, const BuilderProjectModules & x);

void from_json(const json & j, BuilderProjectPackage & x);
void to_json(json & j, const BuilderProjectPackage & x);

void from_json(const json & j, BuilderProjectSource & x);
void to_json(json & j, const BuilderProjectSource & x);

void from_json(const json & j, BuilderProject & x);
void to_json(json & j, const BuilderProject & x);

void from_json(const json & j, CliContainer & x);
void to_json(json & j, const CliContainer & x);

void from_json(const json & j, CommonOptions & x);
void to_json(json & j, const CommonOptions & x);

void from_json(const json & j, CommonResult & x);
void to_json(json & j, const CommonResult & x);

void from_json(const json & j, ContainerProcessStateInfo & x);
void to_json(json & j, const ContainerProcessStateInfo & x);

void from_json(const json & j, DialogHandShakePayload & x);
void to_json(json & j, const DialogHandShakePayload & x);

void from_json(const json & j, DialogMessage & x);
void to_json(json & j, const DialogMessage & x);

void from_json(const json & j, ExportDirs & x);
void to_json(json & j, const ExportDirs & x);

void from_json(const json & j, ExtensionDefine & x);
void to_json(json & j, const ExtensionDefine & x);

void from_json(const json & j, ExtensionImpl & x);
void to_json(json & j, const ExtensionImpl & x);

void from_json(const json & j, InspectResult & x);
void to_json(json & j, const InspectResult & x);

void from_json(const json & j, InteractionReply & x);
void to_json(json & j, const InteractionReply & x);

void from_json(const json & j, InteractionRequest & x);
void to_json(json & j, const InteractionRequest & x);

void from_json(const json & j, LayerInfo & x);
void to_json(json & j, const LayerInfo & x);

void from_json(const json & j, OciConfigurationPatch & x);
void to_json(json & j, const OciConfigurationPatch & x);

void from_json(const json & j, PackageInfo & x);
void to_json(json & j, const PackageInfo & x);

void from_json(const json & j, PackageInfoDisplay & x);
void to_json(json & j, const PackageInfoDisplay & x);

void from_json(const json & j, PackageInfoV2 & x);
void to_json(json & j, const PackageInfoV2 & x);

void from_json(const json & j, PackageManager1GetRepoInfoResultRepoInfo & x);
void to_json(json & j, const PackageManager1GetRepoInfoResultRepoInfo & x);

void from_json(const json & j, PackageManager1GetRepoInfoResult & x);
void to_json(json & j, const PackageManager1GetRepoInfoResult & x);

void from_json(const json & j, PackageManager1InstallParametersPacakge & x);
void to_json(json & j, const PackageManager1InstallParametersPacakge & x);

void from_json(const json & j, PackageManager1InstallParameters & x);
void to_json(json & j, const PackageManager1InstallParameters & x);

void from_json(const json & j, PackageManager1JobInfo & x);
void to_json(json & j, const PackageManager1JobInfo & x);

void from_json(const json & j, PackageManager1ModifyRepoParameters & x);
void to_json(json & j, const PackageManager1ModifyRepoParameters & x);

void from_json(const json & j, PackageManager1Package & x);
void to_json(json & j, const PackageManager1Package & x);

void from_json(const json & j, PackageManager1PackageTaskResult & x);
void to_json(json & j, const PackageManager1PackageTaskResult & x);

void from_json(const json & j, PackageManager1PruneResult & x);
void to_json(json & j, const PackageManager1PruneResult & x);

void from_json(const json & j, PackageManager1RequestInteractionAdditionalMessage & x);
void to_json(json & j, const PackageManager1RequestInteractionAdditionalMessage & x);

void from_json(const json & j, PackageManager1SearchParameters & x);
void to_json(json & j, const PackageManager1SearchParameters & x);

void from_json(const json & j, PackageManager1SearchResult & x);
void to_json(json & j, const PackageManager1SearchResult & x);

void from_json(const json & j, PackageManager1UninstallParameters & x);
void to_json(json & j, const PackageManager1UninstallParameters & x);

void from_json(const json & j, PackageManager1UpdateParameters & x);
void to_json(json & j, const PackageManager1UpdateParameters & x);

void from_json(const json & j, Repo & x);
void to_json(json & j, const Repo & x);

void from_json(const json & j, RepoConfig & x);
void to_json(json & j, const RepoConfig & x);

void from_json(const json & j, RepoConfigV2 & x);
void to_json(json & j, const RepoConfigV2 & x);

void from_json(const json & j, RepositoryCacheLayersItem & x);
void to_json(json & j, const RepositoryCacheLayersItem & x);

void from_json(const json & j, RepositoryCacheMergedItem & x);
void to_json(json & j, const RepositoryCacheMergedItem & x);

void from_json(const json & j, RepositoryCache & x);
void to_json(json & j, const RepositoryCache & x);

void from_json(const json & j, UabLayer & x);
void to_json(json & j, const UabLayer & x);

void from_json(const json & j, Sections & x);
void to_json(json & j, const Sections & x);

void from_json(const json & j, UabMetaInfo & x);
void to_json(json & j, const UabMetaInfo & x);

void from_json(const json & j, UpgradeListResult & x);
void to_json(json & j, const UpgradeListResult & x);

void from_json(const json & j, LinglongAPIV1 & x);
void to_json(json & j, const LinglongAPIV1 & x);

void from_json(const json & j, InteractionMessageType & x);
void to_json(json & j, const InteractionMessageType & x);

void from_json(const json & j, State & x);
void to_json(json & j, const State & x);

void from_json(const json & j, SubState & x);
void to_json(json & j, const SubState & x);

void from_json(const json & j, Version & x);
void to_json(json & j, const Version & x);

inline void from_json(const json & j, ApplicationConfigurationPermissionsBind& x) {
x.destination = j.at("destination").get<std::string>();
x.source = j.at("source").get<std::string>();
}

inline void to_json(json & j, const ApplicationConfigurationPermissionsBind & x) {
j = json::object();
j["destination"] = x.destination;
j["source"] = x.source;
}

inline void from_json(const json & j, ApplicationConfigurationPermissionsInnerBind& x) {
x.destination = j.at("destination").get<std::string>();
x.source = j.at("source").get<std::string>();
}

inline void to_json(json & j, const ApplicationConfigurationPermissionsInnerBind & x) {
j = json::object();
j["destination"] = x.destination;
j["source"] = x.source;
}

inline void from_json(const json & j, XdgDirectoryPermission& x) {
x.allowed = j.at("allowed").get<bool>();
x.dirType = j.at("dirType").get<std::string>();
}

inline void to_json(json & j, const XdgDirectoryPermission & x) {
j = json::object();
j["allowed"] = x.allowed;
j["dirType"] = x.dirType;
}

inline void from_json(const json & j, ApplicationConfigurationPermissions& x) {
x.binds = get_stack_optional<std::vector<ApplicationConfigurationPermissionsBind>>(j, "binds");
x.innerBinds = get_stack_optional<std::vector<ApplicationConfigurationPermissionsInnerBind>>(j, "innerBinds");
x.xdgDirectories = get_stack_optional<std::vector<XdgDirectoryPermission>>(j, "xdgDirectories");
}

inline void to_json(json & j, const ApplicationConfigurationPermissions & x) {
j = json::object();
if (x.binds) {
j["binds"] = x.binds;
}
if (x.innerBinds) {
j["innerBinds"] = x.innerBinds;
}
if (x.xdgDirectories) {
j["xdgDirectories"] = x.xdgDirectories;
}
}

inline void from_json(const json & j, ApplicationConfiguration& x) {
x.permissions = get_stack_optional<ApplicationConfigurationPermissions>(j, "permissions");
x.version = j.at("version").get<std::string>();
}

inline void to_json(json & j, const ApplicationConfiguration & x) {
j = json::object();
if (x.permissions) {
j["permissions"] = x.permissions;
}
j["version"] = x.version;
}

inline void from_json(const json & j, ApplicationPermissionsRequest& x) {
x.appID = j.at("appID").get<std::string>();
x.xdgDirectories = j.at("xdgDirectories").get<std::vector<XdgDirectoryPermission>>();
}

inline void to_json(json & j, const ApplicationPermissionsRequest & x) {
j = json::object();
j["appID"] = x.appID;
j["xdgDirectories"] = x.xdgDirectories;
}

inline void from_json(const json & j, BuilderConfig& x) {
x.arch = get_stack_optional<std::string>(j, "arch");
x.cache = get_stack_optional<std::string>(j, "cache");
x.offline = get_stack_optional<bool>(j, "offline");
x.repo = j.at("repo").get<std::string>();
x.version = j.at("version").get<int64_t>();
}

inline void to_json(json & j, const BuilderConfig & x) {
j = json::object();
if (x.arch) {
j["arch"] = x.arch;
}
if (x.cache) {
j["cache"] = x.cache;
}
if (x.offline) {
j["offline"] = x.offline;
}
j["repo"] = x.repo;
j["version"] = x.version;
}

inline void from_json(const json & j, Apt& x) {
x.buildDepends = get_stack_optional<std::vector<std::string>>(j, "build_depends");
x.depends = get_stack_optional<std::vector<std::string>>(j, "depends");
}

inline void to_json(json & j, const Apt & x) {
j = json::object();
if (x.buildDepends) {
j["build_depends"] = x.buildDepends;
}
if (x.depends) {
j["depends"] = x.depends;
}
}

inline void from_json(const json & j, BuilderProjectBuildEXT& x) {
x.apt = get_stack_optional<Apt>(j, "apt");
}

inline void to_json(json & j, const BuilderProjectBuildEXT & x) {
j = json::object();
if (x.apt) {
j["apt"] = x.apt;
}
}

inline void from_json(const json & j, BuilderProjectModules& x) {
x.files = j.at("files").get<std::vector<std::string>>();
x.name = j.at("name").get<std::string>();
}

inline void to_json(json & j, const BuilderProjectModules & x) {
j = json::object();
j["files"] = x.files;
j["name"] = x.name;
}

inline void from_json(const json & j, BuilderProjectPackage& x) {
x.architecture = get_stack_optional<std::string>(j, "architecture");
x.channel = get_stack_optional<std::string>(j, "channel");
x.description = j.at("description").get<std::string>();
x.env = get_stack_optional<std::map<std::string, std::string>>(j, "env");
x.extensionOf = get_stack_optional<std::string>(j, "extension_of");
x.id = j.at("id").get<std::string>();
x.kind = j.at("kind").get<std::string>();
x.libs = get_stack_optional<std::vector<std::string>>(j, "libs");
x.name = j.at("name").get<std::string>();
x.version = j.at("version").get<std::string>();
}

inline void to_json(json & j, const BuilderProjectPackage & x) {
j = json::object();
if (x.architecture) {
j["architecture"] = x.architecture;
}
if (x.channel) {
j["channel"] = x.channel;
}
j["description"] = x.description;
if (x.env) {
j["env"] = x.env;
}
if (x.extensionOf) {
j["extension_of"] = x.extensionOf;
}
j["id"] = x.id;
j["kind"] = x.kind;
if (x.libs) {
j["libs"] = x.libs;
}
j["name"] = x.name;
j["version"] = x.version;
}

inline void from_json(const json & j, BuilderProjectSource& x) {
x.commit = get_stack_optional<std::string>(j, "commit");
x.digest = get_stack_optional<std::string>(j, "digest");
x.kind = j.at("kind").get<std::string>();
x.name = get_stack_optional<std::string>(j, "name");
x.url = get_stack_optional<std::string>(j, "url");
x.version = get_stack_optional<std::string>(j, "version");
}

inline void to_json(json & j, const BuilderProjectSource & x) {
j = json::object();
if (x.commit) {
j["commit"] = x.commit;
}
if (x.digest) {
j["digest"] = x.digest;
}
j["kind"] = x.kind;
if (x.name) {
j["name"] = x.name;
}
if (x.url) {
j["url"] = x.url;
}
if (x.version) {
j["version"] = x.version;
}
}

inline void from_json(const json & j, BuilderProject& x) {
x.base = j.at("base").get<std::string>();
x.build = j.at("build").get<std::string>();
x.buildext = get_stack_optional<BuilderProjectBuildEXT>(j, "buildext");
x.command = get_stack_optional<std::vector<std::string>>(j, "command");
x.exclude = get_stack_optional<std::vector<std::string>>(j, "exclude");
x.include = get_stack_optional<std::vector<std::string>>(j, "include");
x.modules = get_stack_optional<std::vector<BuilderProjectModules>>(j, "modules");
x.package = j.at("package").get<BuilderProjectPackage>();
x.permissions = get_stack_optional<ApplicationConfigurationPermissions>(j, "permissions");
x.runtime = get_stack_optional<std::string>(j, "runtime");
x.sources = get_stack_optional<std::vector<BuilderProjectSource>>(j, "sources");
x.strip = get_stack_optional<std::string>(j, "strip");
x.version = j.at("version").get<std::string>();
}

inline void to_json(json & j, const BuilderProject & x) {
j = json::object();
j["base"] = x.base;
j["build"] = x.build;
if (x.buildext) {
j["buildext"] = x.buildext;
}
if (x.command) {
j["command"] = x.command;
}
if (x.exclude) {
j["exclude"] = x.exclude;
}
if (x.include) {
j["include"] = x.include;
}
if (x.modules) {
j["modules"] = x.modules;
}
j["package"] = x.package;
if (x.permissions) {
j["permissions"] = x.permissions;
}
if (x.runtime) {
j["runtime"] = x.runtime;
}
if (x.sources) {
j["sources"] = x.sources;
}
if (x.strip) {
j["strip"] = x.strip;
}
j["version"] = x.version;
}

inline void from_json(const json & j, CliContainer& x) {
x.id = j.at("id").get<std::string>();
x.package = j.at("package").get<std::string>();
x.pid = j.at("pid").get<int64_t>();
}

inline void to_json(json & j, const CliContainer & x) {
j = json::object();
j["id"] = x.id;
j["package"] = x.package;
j["pid"] = x.pid;
}

inline void from_json(const json & j, CommonOptions& x) {
x.force = j.at("force").get<bool>();
x.skipInteraction = j.at("skipInteraction").get<bool>();
}

inline void to_json(json & j, const CommonOptions & x) {
j = json::object();
j["force"] = x.force;
j["skipInteraction"] = x.skipInteraction;
}

inline void from_json(const json & j, CommonResult& x) {
x.code = j.at("code").get<int64_t>();
x.message = j.at("message").get<std::string>();
x.type = j.at("type").get<std::string>();
}

inline void to_json(json & j, const CommonResult & x) {
j = json::object();
j["code"] = x.code;
j["message"] = x.message;
j["type"] = x.type;
}

inline void from_json(const json & j, ContainerProcessStateInfo& x) {
x.app = j.at("app").get<std::string>();
x.base = j.at("base").get<std::string>();
x.containerID = j.at("containerID").get<std::string>();
x.runtime = get_stack_optional<std::string>(j, "runtime");
}

inline void to_json(json & j, const ContainerProcessStateInfo & x) {
j = json::object();
j["app"] = x.app;
j["base"] = x.base;
j["containerID"] = x.containerID;
if (x.runtime) {
j["runtime"] = x.runtime;
}
}

inline void from_json(const json & j, DialogHandShakePayload& x) {
x.version = j.at("version").get<std::string>();
}

inline void to_json(json & j, const DialogHandShakePayload & x) {
j = json::object();
j["version"] = x.version;
}

inline void from_json(const json & j, DialogMessage& x) {
x.payload = j.at("payload").get<std::string>();
x.type = j.at("type").get<std::string>();
}

inline void to_json(json & j, const DialogMessage & x) {
j = json::object();
j["payload"] = x.payload;
j["type"] = x.type;
}

inline void from_json(const json & j, ExportDirs& x) {
x.exportPaths = j.at("export-paths").get<std::vector<std::string>>();
}

inline void to_json(json & j, const ExportDirs & x) {
j = json::object();
j["export-paths"] = x.exportPaths;
}

inline void from_json(const json & j, ExtensionDefine& x) {
x.allowEnv = get_stack_optional<std::map<std::string, std::string>>(j, "allow_env");
x.directory = j.at("directory").get<std::string>();
x.name = j.at("name").get<std::string>();
x.version = j.at("version").get<std::string>();
}

inline void to_json(json & j, const ExtensionDefine & x) {
j = json::object();
if (x.allowEnv) {
j["allow_env"] = x.allowEnv;
}
j["directory"] = x.directory;
j["name"] = x.name;
j["version"] = x.version;
}

inline void from_json(const json & j, ExtensionImpl& x) {
x.env = get_stack_optional<std::map<std::string, std::string>>(j, "env");
x.libs = get_stack_optional<std::vector<std::string>>(j, "libs");
}

inline void to_json(json & j, const ExtensionImpl & x) {
j = json::object();
if (x.env) {
j["env"] = x.env;
}
if (x.libs) {
j["libs"] = x.libs;
}
}

inline void from_json(const json & j, InspectResult& x) {
x.appID = get_stack_optional<std::string>(j, "appID");
}

inline void to_json(json & j, const InspectResult & x) {
j = json::object();
if (x.appID) {
j["appID"] = x.appID;
}
}

inline void from_json(const json & j, InteractionReply& x) {
x.action = get_stack_optional<std::string>(j, "action");
}

inline void to_json(json & j, const InteractionReply & x) {
j = json::object();
if (x.action) {
j["action"] = x.action;
}
}

inline void from_json(const json & j, InteractionRequest& x) {
x.actions = get_stack_optional<std::vector<std::string>>(j, "actions");
x.appName = j.at("appName").get<std::string>();
x.body = get_stack_optional<std::string>(j, "body");
x.summary = j.at("summary").get<std::string>();
x.timeout = j.at("timeout").get<int64_t>();
}

inline void to_json(json & j, const InteractionRequest & x) {
j = json::object();
if (x.actions) {
j["actions"] = x.actions;
}
j["appName"] = x.appName;
if (x.body) {
j["body"] = x.body;
}
j["summary"] = x.summary;
j["timeout"] = x.timeout;
}

inline void from_json(const json & j, LayerInfo& x) {
x.info = get_untyped(j, "info");
x.version = j.at("version").get<std::string>();
}

inline void to_json(json & j, const LayerInfo & x) {
j = json::object();
j["info"] = x.info;
j["version"] = x.version;
}

inline void from_json(const json & j, OciConfigurationPatch& x) {
x.ociVersion = j.at("ociVersion").get<std::string>();
x.patch = j.at("patch").get<std::vector<nlohmann::json>>();
}

inline void to_json(json & j, const OciConfigurationPatch & x) {
j = json::object();
j["ociVersion"] = x.ociVersion;
j["patch"] = x.patch;
}

inline void from_json(const json & j, PackageInfo& x) {
x.appid = j.at("appid").get<std::string>();
x.arch = j.at("arch").get<std::vector<std::string>>();
x.base = j.at("base").get<std::string>();
x.channel = get_stack_optional<std::string>(j, "channel");
x.command = get_stack_optional<std::vector<std::string>>(j, "command");
x.description = get_stack_optional<std::string>(j, "description");
x.kind = j.at("kind").get<std::string>();
x.packageInfoModule = j.at("module").get<std::string>();
x.name = j.at("name").get<std::string>();
x.permissions = get_stack_optional<ApplicationConfigurationPermissions>(j, "permissions");
x.runtime = get_stack_optional<std::string>(j, "runtime");
x.size = j.at("size").get<int64_t>();
x.version = j.at("version").get<std::string>();
}

inline void to_json(json & j, const PackageInfo & x) {
j = json::object();
j["appid"] = x.appid;
j["arch"] = x.arch;
j["base"] = x.base;
if (x.channel) {
j["channel"] = x.channel;
}
if (x.command) {
j["command"] = x.command;
}
if (x.description) {
j["description"] = x.description;
}
j["kind"] = x.kind;
j["module"] = x.packageInfoModule;
j["name"] = x.name;
if (x.permissions) {
j["permissions"] = x.permissions;
}
if (x.runtime) {
j["runtime"] = x.runtime;
}
j["size"] = x.size;
j["version"] = x.version;
}

inline void from_json(const json & j, PackageInfoDisplay& x) {
x.arch = j.at("arch").get<std::vector<std::string>>();
x.base = j.at("base").get<std::string>();
x.channel = j.at("channel").get<std::string>();
x.command = get_stack_optional<std::vector<std::string>>(j, "command");
x.compatibleVersion = get_stack_optional<std::string>(j, "compatible_version");
x.description = get_stack_optional<std::string>(j, "description");
x.extImpl = get_stack_optional<ExtensionImpl>(j, "ext_impl");
x.extensions = get_stack_optional<std::vector<ExtensionDefine>>(j, "extensions");
x.id = j.at("id").get<std::string>();
x.kind = j.at("kind").get<std::string>();
x.packageInfoDisplayModule = j.at("module").get<std::string>();
x.name = j.at("name").get<std::string>();
x.permissions = get_stack_optional<ApplicationConfigurationPermissions>(j, "permissions");
x.runtime = get_stack_optional<std::string>(j, "runtime");
x.schemaVersion = j.at("schema_version").get<std::string>();
x.size = j.at("size").get<int64_t>();
x.uuid = get_stack_optional<std::string>(j, "uuid");
x.version = j.at("version").get<std::string>();
x.installTime = get_stack_optional<int64_t>(j, "install_time");
}

inline void to_json(json & j, const PackageInfoDisplay & x) {
j = json::object();
j["arch"] = x.arch;
j["base"] = x.base;
j["channel"] = x.channel;
if (x.command) {
j["command"] = x.command;
}
if (x.compatibleVersion) {
j["compatible_version"] = x.compatibleVersion;
}
if (x.description) {
j["description"] = x.description;
}
if (x.extImpl) {
j["ext_impl"] = x.extImpl;
}
if (x.extensions) {
j["extensions"] = x.extensions;
}
j["id"] = x.id;
j["kind"] = x.kind;
j["module"] = x.packageInfoDisplayModule;
j["name"] = x.name;
if (x.permissions) {
j["permissions"] = x.permissions;
}
if (x.runtime) {
j["runtime"] = x.runtime;
}
j["schema_version"] = x.schemaVersion;
j["size"] = x.size;
if (x.uuid) {
j["uuid"] = x.uuid;
}
j["version"] = x.version;
if (x.installTime) {
j["install_time"] = x.installTime;
}
}

inline void from_json(const json & j, PackageInfoV2& x) {
x.arch = j.at("arch").get<std::vector<std::string>>();
x.base = j.at("base").get<std::string>();
x.channel = j.at("channel").get<std::string>();
x.command = get_stack_optional<std::vector<std::string>>(j, "command");
x.compatibleVersion = get_stack_optional<std::string>(j, "compatible_version");
x.description = get_stack_optional<std::string>(j, "description");
x.extImpl = get_stack_optional<ExtensionImpl>(j, "ext_impl");
x.extensions = get_stack_optional<std::vector<ExtensionDefine>>(j, "extensions");
x.id = j.at("id").get<std::string>();
x.kind = j.at("kind").get<std::string>();
x.packageInfoV2Module = j.at("module").get<std::string>();
x.name = j.at("name").get<std::string>();
x.permissions = get_stack_optional<ApplicationConfigurationPermissions>(j, "permissions");
x.runtime = get_stack_optional<std::string>(j, "runtime");
x.schemaVersion = j.at("schema_version").get<std::string>();
x.size = j.at("size").get<int64_t>();
x.uuid = get_stack_optional<std::string>(j, "uuid");
x.version = j.at("version").get<std::string>();
}

inline void to_json(json & j, const PackageInfoV2 & x) {
j = json::object();
j["arch"] = x.arch;
j["base"] = x.base;
j["channel"] = x.channel;
if (x.command) {
j["command"] = x.command;
}
if (x.compatibleVersion) {
j["compatible_version"] = x.compatibleVersion;
}
if (x.description) {
j["description"] = x.description;
}
if (x.extImpl) {
j["ext_impl"] = x.extImpl;
}
if (x.extensions) {
j["extensions"] = x.extensions;
}
j["id"] = x.id;
j["kind"] = x.kind;
j["module"] = x.packageInfoV2Module;
j["name"] = x.name;
if (x.permissions) {
j["permissions"] = x.permissions;
}
if (x.runtime) {
j["runtime"] = x.runtime;
}
j["schema_version"] = x.schemaVersion;
j["size"] = x.size;
if (x.uuid) {
j["uuid"] = x.uuid;
}
j["version"] = x.version;
}

inline void from_json(const json & j, PackageManager1GetRepoInfoResultRepoInfo& x) {
x.defaultRepo = j.at("defaultRepo").get<std::string>();
x.repos = j.at("repos").get<std::map<std::string, std::string>>();
}

inline void to_json(json & j, const PackageManager1GetRepoInfoResultRepoInfo & x) {
j = json::object();
j["defaultRepo"] = x.defaultRepo;
j["repos"] = x.repos;
}

inline void from_json(const json & j, PackageManager1GetRepoInfoResult& x) {
x.repoInfo = j.at("repoInfo").get<PackageManager1GetRepoInfoResultRepoInfo>();
x.code = j.at("code").get<int64_t>();
x.message = j.at("message").get<std::string>();
x.type = j.at("type").get<std::string>();
}

inline void to_json(json & j, const PackageManager1GetRepoInfoResult & x) {
j = json::object();
j["repoInfo"] = x.repoInfo;
j["code"] = x.code;
j["message"] = x.message;
j["type"] = x.type;
}

inline void from_json(const json & j, PackageManager1InstallParametersPacakge& x) {
x.channel = get_stack_optional<std::string>(j, "channel");
x.id = j.at("id").get<std::string>();
x.modules = get_stack_optional<std::vector<std::string>>(j, "modules");
x.version = get_stack_optional<std::string>(j, "version");
}

inline void to_json(json & j, const PackageManager1InstallParametersPacakge & x) {
j = json::object();
if (x.channel) {
j["channel"] = x.channel;
}
j["id"] = x.id;
if (x.modules) {
j["modules"] = x.modules;
}
if (x.version) {
j["version"] = x.version;
}
}

inline void from_json(const json & j, PackageManager1InstallParameters& x) {
x.options = j.at("options").get<CommonOptions>();
x.package = j.at("package").get<PackageManager1InstallParametersPacakge>();
x.repo = get_stack_optional<std::string>(j, "repo");
}

inline void to_json(json & j, const PackageManager1InstallParameters & x) {
j = json::object();
j["options"] = x.options;
j["package"] = x.package;
if (x.repo) {
j["repo"] = x.repo;
}
}

inline void from_json(const json & j, PackageManager1JobInfo& x) {
x.id = j.at("id").get<std::string>();
x.code = j.at("code").get<int64_t>();
x.message = j.at("message").get<std::string>();
x.type = j.at("type").get<std::string>();
}

inline void to_json(json & j, const PackageManager1JobInfo & x) {
j = json::object();
j["id"] = x.id;
j["code"] = x.code;
j["message"] = x.message;
j["type"] = x.type;
}

inline void from_json(const json & j, PackageManager1ModifyRepoParameters& x) {
x.defaultRepo = j.at("defaultRepo").get<std::string>();
x.repos = j.at("repos").get<std::map<std::string, std::string>>();
}

inline void to_json(json & j, const PackageManager1ModifyRepoParameters & x) {
j = json::object();
j["defaultRepo"] = x.defaultRepo;
j["repos"] = x.repos;
}

inline void from_json(const json & j, PackageManager1Package& x) {
x.channel = get_stack_optional<std::string>(j, "channel");
x.id = j.at("id").get<std::string>();
x.packageManager1PackageModule = get_stack_optional<std::string>(j, "module");
x.version = get_stack_optional<std::string>(j, "version");
}

inline void to_json(json & j, const PackageManager1Package & x) {
j = json::object();
if (x.channel) {
j["channel"] = x.channel;
}
j["id"] = x.id;
if (x.packageManager1PackageModule) {
j["module"] = x.packageManager1PackageModule;
}
if (x.version) {
j["version"] = x.version;
}
}

inline void from_json(const json & j, PackageManager1PackageTaskResult& x) {
x.taskObjectPath = get_stack_optional<std::string>(j, "taskObjectPath");
x.code = j.at("code").get<int64_t>();
x.message = j.at("message").get<std::string>();
x.type = j.at("type").get<std::string>();
}

inline void to_json(json & j, const PackageManager1PackageTaskResult & x) {
j = json::object();
if (x.taskObjectPath) {
j["taskObjectPath"] = x.taskObjectPath;
}
j["code"] = x.code;
j["message"] = x.message;
j["type"] = x.type;
}

inline void from_json(const json & j, PackageManager1PruneResult& x) {
x.packages = get_stack_optional<std::vector<PackageInfoV2>>(j, "packages");
x.code = j.at("code").get<int64_t>();
x.message = j.at("message").get<std::string>();
x.type = j.at("type").get<std::string>();
}

inline void to_json(json & j, const PackageManager1PruneResult & x) {
j = json::object();
if (x.packages) {
j["packages"] = x.packages;
}
j["code"] = x.code;
j["message"] = x.message;
j["type"] = x.type;
}

inline void from_json(const json & j, PackageManager1RequestInteractionAdditionalMessage& x) {
x.localRef = j.at("LocalRef").get<std::string>();
x.remoteRef = j.at("RemoteRef").get<std::string>();
}

inline void to_json(json & j, const PackageManager1RequestInteractionAdditionalMessage & x) {
j = json::object();
j["LocalRef"] = x.localRef;
j["RemoteRef"] = x.remoteRef;
}

inline void from_json(const json & j, PackageManager1SearchParameters& x) {
x.id = j.at("id").get<std::string>();
x.repos = j.at("repos").get<std::vector<std::string>>();
}

inline void to_json(json & j, const PackageManager1SearchParameters & x) {
j = json::object();
j["id"] = x.id;
j["repos"] = x.repos;
}

inline void from_json(const json & j, PackageManager1SearchResult& x) {
x.packages = get_stack_optional<std::map<std::string, std::vector<PackageInfoV2>>>(j, "packages");
x.code = j.at("code").get<int64_t>();
x.message = j.at("message").get<std::string>();
x.type = j.at("type").get<std::string>();
}

inline void to_json(json & j, const PackageManager1SearchResult & x) {
j = json::object();
if (x.packages) {
j["packages"] = x.packages;
}
j["code"] = x.code;
j["message"] = x.message;
j["type"] = x.type;
}

inline void from_json(const json & j, PackageManager1UninstallParameters& x) {
x.package = j.at("package").get<PackageManager1Package>();
}

inline void to_json(json & j, const PackageManager1UninstallParameters & x) {
j = json::object();
j["package"] = x.package;
}

inline void from_json(const json & j, PackageManager1UpdateParameters& x) {
x.packages = j.at("packages").get<std::vector<PackageManager1Package>>();
}

inline void to_json(json & j, const PackageManager1UpdateParameters & x) {
j = json::object();
j["packages"] = x.packages;
}

inline void from_json(const json & j, Repo& x) {
x.alias = get_stack_optional<std::string>(j, "alias");
x.name = j.at("name").get<std::string>();
x.priority = j.at("priority").get<int64_t>();
x.url = j.at("url").get<std::string>();
}

inline void to_json(json & j, const Repo & x) {
j = json::object();
if (x.alias) {
j["alias"] = x.alias;
}
j["name"] = x.name;
j["priority"] = x.priority;
j["url"] = x.url;
}

inline void from_json(const json & j, RepoConfig& x) {
x.defaultRepo = j.at("defaultRepo").get<std::string>();
x.repos = j.at("repos").get<std::map<std::string, std::string>>();
x.version = j.at("version").get<int64_t>();
}

inline void to_json(json & j, const RepoConfig & x) {
j = json::object();
j["defaultRepo"] = x.defaultRepo;
j["repos"] = x.repos;
j["version"] = x.version;
}

inline void from_json(const json & j, RepoConfigV2& x) {
x.defaultRepo = j.at("defaultRepo").get<std::string>();
x.repos = j.at("repos").get<std::vector<Repo>>();
x.version = j.at("version").get<int64_t>();
}

inline void to_json(json & j, const RepoConfigV2 & x) {
j = json::object();
j["defaultRepo"] = x.defaultRepo;
j["repos"] = x.repos;
j["version"] = x.version;
}

inline void from_json(const json & j, RepositoryCacheLayersItem& x) {
x.commit = j.at("commit").get<std::string>();
x.deleted = get_stack_optional<bool>(j, "deleted");
x.info = j.at("info").get<PackageInfoV2>();
x.repo = j.at("repo").get<std::string>();
}

inline void to_json(json & j, const RepositoryCacheLayersItem & x) {
j = json::object();
j["commit"] = x.commit;
if (x.deleted) {
j["deleted"] = x.deleted;
}
j["info"] = x.info;
j["repo"] = x.repo;
}

inline void from_json(const json & j, RepositoryCacheMergedItem& x) {
x.binaryCommit = get_stack_optional<std::string>(j, "binaryCommit");
x.commits = j.at("commits").get<std::vector<std::string>>();
x.id = j.at("id").get<std::string>();
x.modules = j.at("modules").get<std::vector<std::string>>();
x.name = get_stack_optional<std::string>(j, "name");
}

inline void to_json(json & j, const RepositoryCacheMergedItem & x) {
j = json::object();
if (x.binaryCommit) {
j["binaryCommit"] = x.binaryCommit;
}
j["commits"] = x.commits;
j["id"] = x.id;
j["modules"] = x.modules;
if (x.name) {
j["name"] = x.name;
}
}

inline void from_json(const json & j, RepositoryCache& x) {
x.config = j.at("config").get<RepoConfigV2>();
x.layers = j.at("layers").get<std::vector<RepositoryCacheLayersItem>>();
x.llVersion = j.at("ll-version").get<std::string>();
x.merged = get_stack_optional<std::vector<RepositoryCacheMergedItem>>(j, "merged");
x.version = j.at("version").get<std::string>();
}

inline void to_json(json & j, const RepositoryCache & x) {
j = json::object();
j["config"] = x.config;
j["layers"] = x.layers;
j["ll-version"] = x.llVersion;
if (x.merged) {
j["merged"] = x.merged;
}
j["version"] = x.version;
}

inline void from_json(const json & j, UabLayer& x) {
x.info = j.at("info").get<PackageInfoV2>();
x.minified = j.at("minified").get<bool>();
}

inline void to_json(json & j, const UabLayer & x) {
j = json::object();
j["info"] = x.info;
j["minified"] = x.minified;
}

inline void from_json(const json & j, Sections& x) {
x.bundle = j.at("bundle").get<std::string>();
x.icon = get_stack_optional<std::string>(j, "icon");
}

inline void to_json(json & j, const Sections & x) {
j = json::object();
j["bundle"] = x.bundle;
if (x.icon) {
j["icon"] = x.icon;
}
}

inline void from_json(const json & j, UabMetaInfo& x) {
x.digest = j.at("digest").get<std::string>();
x.layers = j.at("layers").get<std::vector<UabLayer>>();
x.onlyApp = get_stack_optional<bool>(j, "onlyApp");
x.sections = j.at("sections").get<Sections>();
x.uuid = j.at("uuid").get<std::string>();
x.version = j.at("version").get<Version>();
}

inline void to_json(json & j, const UabMetaInfo & x) {
j = json::object();
j["digest"] = x.digest;
j["layers"] = x.layers;
if (x.onlyApp) {
j["onlyApp"] = x.onlyApp;
}
j["sections"] = x.sections;
j["uuid"] = x.uuid;
j["version"] = x.version;
}

inline void from_json(const json & j, UpgradeListResult& x) {
x.id = j.at("id").get<std::string>();
x.newVersion = j.at("new_version").get<std::string>();
x.oldVersion = j.at("old_version").get<std::string>();
}

inline void to_json(json & j, const UpgradeListResult & x) {
j = json::object();
j["id"] = x.id;
j["new_version"] = x.newVersion;
j["old_version"] = x.oldVersion;
}

inline void from_json(const json & j, LinglongAPIV1& x) {
x.applicationConfiguration = get_stack_optional<ApplicationConfiguration>(j, "ApplicationConfiguration");
x.applicationConfigurationPermissions = get_stack_optional<ApplicationConfigurationPermissions>(j, "ApplicationConfigurationPermissions");
x.applicationPermissionsRequest = get_stack_optional<ApplicationPermissionsRequest>(j, "ApplicationPermissionsRequest");
x.builderConfig = get_stack_optional<BuilderConfig>(j, "BuilderConfig");
x.builderProject = get_stack_optional<BuilderProject>(j, "BuilderProject");
x.cliContainer = get_stack_optional<CliContainer>(j, "CLIContainer");
x.commonOptions = get_stack_optional<CommonOptions>(j, "CommonOptions");
x.commonResult = get_stack_optional<CommonResult>(j, "CommonResult");
x.containerProcessStateInfo = get_stack_optional<ContainerProcessStateInfo>(j, "ContainerProcessStateInfo");
x.dialogHandShakePayload = get_stack_optional<DialogHandShakePayload>(j, "DialogHandShakePayload");
x.dialogMessage = get_stack_optional<DialogMessage>(j, "DialogMessage");
x.exportDirs = get_stack_optional<ExportDirs>(j, "ExportDirs");
x.extensionDefine = get_stack_optional<ExtensionDefine>(j, "ExtensionDefine");
x.extensionImpl = get_stack_optional<ExtensionImpl>(j, "ExtensionImpl");
x.inspectResult = get_stack_optional<InspectResult>(j, "InspectResult");
x.interactionMessageType = get_stack_optional<InteractionMessageType>(j, "InteractionMessageType");
x.interactionReply = get_stack_optional<InteractionReply>(j, "InteractionReply");
x.interactionRequest = get_stack_optional<InteractionRequest>(j, "InteractionRequest");
x.layerInfo = get_stack_optional<LayerInfo>(j, "LayerInfo");
x.ociConfigurationPatch = get_stack_optional<OciConfigurationPatch>(j, "OCIConfigurationPatch");
x.packageInfo = get_stack_optional<PackageInfo>(j, "PackageInfo");
x.packageInfoDisplay = get_stack_optional<PackageInfoDisplay>(j, "PackageInfoDisplay");
x.packageInfoV2 = get_stack_optional<PackageInfoV2>(j, "PackageInfoV2");
x.packageManager1GetRepoInfoResult = get_stack_optional<PackageManager1GetRepoInfoResult>(j, "PackageManager1GetRepoInfoResult");
x.packageManager1InstallLayerFDResult = get_stack_optional<CommonResult>(j, "PackageManager1InstallLayerFDResult");
x.packageManager1InstallParameters = get_stack_optional<PackageManager1InstallParameters>(j, "PackageManager1InstallParameters");
x.packageManager1JobInfo = get_stack_optional<PackageManager1JobInfo>(j, "PackageManager1JobInfo");
x.packageManager1ModifyRepoParameters = get_stack_optional<PackageManager1ModifyRepoParameters>(j, "PackageManager1ModifyRepoParameters");
x.packageManager1ModifyRepoResult = get_stack_optional<CommonResult>(j, "PackageManager1ModifyRepoResult");
x.packageManager1Package = get_stack_optional<PackageManager1Package>(j, "PackageManager1Package");
x.packageManager1PackageTaskResult = get_stack_optional<PackageManager1PackageTaskResult>(j, "PackageManager1PackageTaskResult");
x.packageManager1PruneResult = get_stack_optional<PackageManager1PruneResult>(j, "PackageManager1PruneResult");
x.packageManager1RequestInteractionAdditionalMessage = get_stack_optional<PackageManager1RequestInteractionAdditionalMessage>(j, "PackageManager1RequestInteractionAdditionalMessage");
x.packageManager1SearchParameters = get_stack_optional<PackageManager1SearchParameters>(j, "PackageManager1SearchParameters");
x.packageManager1SearchResult = get_stack_optional<PackageManager1SearchResult>(j, "PackageManager1SearchResult");
x.packageManager1UninstallParameters = get_stack_optional<PackageManager1UninstallParameters>(j, "PackageManager1UninstallParameters");
x.packageManager1UpdateParameters = get_stack_optional<PackageManager1UpdateParameters>(j, "PackageManager1UpdateParameters");
x.repo = get_stack_optional<Repo>(j, "Repo");
x.repoConfig = get_stack_optional<RepoConfig>(j, "RepoConfig");
x.repoConfigV2 = get_stack_optional<RepoConfigV2>(j, "RepoConfigV2");
x.repositoryCache = get_stack_optional<RepositoryCache>(j, "RepositoryCache");
x.state = get_stack_optional<State>(j, "State");
x.subState = get_stack_optional<SubState>(j, "SubState");
x.uabMetaInfo = get_stack_optional<UabMetaInfo>(j, "UABMetaInfo");
x.upgradeListResult = get_stack_optional<UpgradeListResult>(j, "UpgradeListResult");
x.xdgDirectoryPermissions = get_stack_optional<std::vector<XdgDirectoryPermission>>(j, "XDGDirectoryPermissions");
}

inline void to_json(json & j, const LinglongAPIV1 & x) {
j = json::object();
if (x.applicationConfiguration) {
j["ApplicationConfiguration"] = x.applicationConfiguration;
}
if (x.applicationConfigurationPermissions) {
j["ApplicationConfigurationPermissions"] = x.applicationConfigurationPermissions;
}
if (x.applicationPermissionsRequest) {
j["ApplicationPermissionsRequest"] = x.applicationPermissionsRequest;
}
if (x.builderConfig) {
j["BuilderConfig"] = x.builderConfig;
}
if (x.builderProject) {
j["BuilderProject"] = x.builderProject;
}
if (x.cliContainer) {
j["CLIContainer"] = x.cliContainer;
}
if (x.commonOptions) {
j["CommonOptions"] = x.commonOptions;
}
if (x.commonResult) {
j["CommonResult"] = x.commonResult;
}
if (x.containerProcessStateInfo) {
j["ContainerProcessStateInfo"] = x.containerProcessStateInfo;
}
if (x.dialogHandShakePayload) {
j["DialogHandShakePayload"] = x.dialogHandShakePayload;
}
if (x.dialogMessage) {
j["DialogMessage"] = x.dialogMessage;
}
if (x.exportDirs) {
j["ExportDirs"] = x.exportDirs;
}
if (x.extensionDefine) {
j["ExtensionDefine"] = x.extensionDefine;
}
if (x.extensionImpl) {
j["ExtensionImpl"] = x.extensionImpl;
}
if (x.inspectResult) {
j["InspectResult"] = x.inspectResult;
}
if (x.interactionMessageType) {
j["InteractionMessageType"] = x.interactionMessageType;
}
if (x.interactionReply) {
j["InteractionReply"] = x.interactionReply;
}
if (x.interactionRequest) {
j["InteractionRequest"] = x.interactionRequest;
}
if (x.layerInfo) {
j["LayerInfo"] = x.layerInfo;
}
if (x.ociConfigurationPatch) {
j["OCIConfigurationPatch"] = x.ociConfigurationPatch;
}
if (x.packageInfo) {
j["PackageInfo"] = x.packageInfo;
}
if (x.packageInfoDisplay) {
j["PackageInfoDisplay"] = x.packageInfoDisplay;
}
if (x.packageInfoV2) {
j["PackageInfoV2"] = x.packageInfoV2;
}
if (x.packageManager1GetRepoInfoResult) {
j["PackageManager1GetRepoInfoResult"] = x.packageManager1GetRepoInfoResult;
}
if (x.packageManager1InstallLayerFDResult) {
j["PackageManager1InstallLayerFDResult"] = x.packageManager1InstallLayerFDResult;
}
if (x.packageManager1InstallParameters) {
j["PackageManager1InstallParameters"] = x.packageManager1InstallParameters;
}
if (x.packageManager1JobInfo) {
j["PackageManager1JobInfo"] = x.packageManager1JobInfo;
}
if (x.packageManager1ModifyRepoParameters) {
j["PackageManager1ModifyRepoParameters"] = x.packageManager1ModifyRepoParameters;
}
if (x.packageManager1ModifyRepoResult) {
j["PackageManager1ModifyRepoResult"] = x.packageManager1ModifyRepoResult;
}
if (x.packageManager1Package) {
j["PackageManager1Package"] = x.packageManager1Package;
}
if (x.packageManager1PackageTaskResult) {
j["PackageManager1PackageTaskResult"] = x.packageManager1PackageTaskResult;
}
if (x.packageManager1PruneResult) {
j["PackageManager1PruneResult"] = x.packageManager1PruneResult;
}
if (x.packageManager1RequestInteractionAdditionalMessage) {
j["PackageManager1RequestInteractionAdditionalMessage"] = x.packageManager1RequestInteractionAdditionalMessage;
}
if (x.packageManager1SearchParameters) {
j["PackageManager1SearchParameters"] = x.packageManager1SearchParameters;
}
if (x.packageManager1SearchResult) {
j["PackageManager1SearchResult"] = x.packageManager1SearchResult;
}
if (x.packageManager1UninstallParameters) {
j["PackageManager1UninstallParameters"] = x.packageManager1UninstallParameters;
}
if (x.packageManager1UpdateParameters) {
j["PackageManager1UpdateParameters"] = x.packageManager1UpdateParameters;
}
if (x.repo) {
j["Repo"] = x.repo;
}
if (x.repoConfig) {
j["RepoConfig"] = x.repoConfig;
}
if (x.repoConfigV2) {
j["RepoConfigV2"] = x.repoConfigV2;
}
if (x.repositoryCache) {
j["RepositoryCache"] = x.repositoryCache;
}
if (x.state) {
j["State"] = x.state;
}
if (x.subState) {
j["SubState"] = x.subState;
}
if (x.uabMetaInfo) {
j["UABMetaInfo"] = x.uabMetaInfo;
}
if (x.upgradeListResult) {
j["UpgradeListResult"] = x.upgradeListResult;
}
if (x.xdgDirectoryPermissions) {
j["XDGDirectoryPermissions"] = x.xdgDirectoryPermissions;
}
}

inline void from_json(const json & j, InteractionMessageType & x) {
if (j == "Downgrade") x = InteractionMessageType::Downgrade;
else if (j == "Install") x = InteractionMessageType::Install;
else if (j == "Uninstall") x = InteractionMessageType::Uninstall;
else if (j == "Unknown") x = InteractionMessageType::Unknown;
else if (j == "Upgrade") x = InteractionMessageType::Upgrade;
else { throw std::runtime_error("Input JSON does not conform to schema!"); }
}

inline void to_json(json & j, const InteractionMessageType & x) {
switch (x) {
case InteractionMessageType::Downgrade: j = "Downgrade"; break;
case InteractionMessageType::Install: j = "Install"; break;
case InteractionMessageType::Uninstall: j = "Uninstall"; break;
case InteractionMessageType::Unknown: j = "Unknown"; break;
case InteractionMessageType::Upgrade: j = "Upgrade"; break;
default: throw std::runtime_error("Unexpected value in enumeration \"[object Object]\": " + std::to_string(static_cast<int>(x)));
}
}

inline void from_json(const json & j, State & x) {
if (j == "Canceled") x = State::Canceled;
else if (j == "Failed") x = State::Failed;
else if (j == "PartCompleted") x = State::PartCompleted;
else if (j == "Pending") x = State::Pending;
else if (j == "Processing") x = State::Processing;
else if (j == "Queued") x = State::Queued;
else if (j == "Succeed") x = State::Succeed;
else if (j == "Unknown") x = State::Unknown;
else { throw std::runtime_error("Input JSON does not conform to schema!"); }
}

inline void to_json(json & j, const State & x) {
switch (x) {
case State::Canceled: j = "Canceled"; break;
case State::Failed: j = "Failed"; break;
case State::PartCompleted: j = "PartCompleted"; break;
case State::Pending: j = "Pending"; break;
case State::Processing: j = "Processing"; break;
case State::Queued: j = "Queued"; break;
case State::Succeed: j = "Succeed"; break;
case State::Unknown: j = "Unknown"; break;
default: throw std::runtime_error("Unexpected value in enumeration \"[object Object]\": " + std::to_string(static_cast<int>(x)));
}
}

inline void from_json(const json & j, SubState & x) {
if (j == "AllDone") x = SubState::AllDone;
else if (j == "InstallApplication") x = SubState::InstallApplication;
else if (j == "InstallBase") x = SubState::InstallBase;
else if (j == "InstallRuntime") x = SubState::InstallRuntime;
else if (j == "PackageManagerDone") x = SubState::PackageManagerDone;
else if (j == "PostAction") x = SubState::PostAction;
else if (j == "PreAction") x = SubState::PreAction;
else if (j == "Uninstall") x = SubState::Uninstall;
else if (j == "Unknown") x = SubState::Unknown;
else { throw std::runtime_error("Input JSON does not conform to schema!"); }
}

inline void to_json(json & j, const SubState & x) {
switch (x) {
case SubState::AllDone: j = "AllDone"; break;
case SubState::InstallApplication: j = "InstallApplication"; break;
case SubState::InstallBase: j = "InstallBase"; break;
case SubState::InstallRuntime: j = "InstallRuntime"; break;
case SubState::PackageManagerDone: j = "PackageManagerDone"; break;
case SubState::PostAction: j = "PostAction"; break;
case SubState::PreAction: j = "PreAction"; break;
case SubState::Uninstall: j = "Uninstall"; break;
case SubState::Unknown: j = "Unknown"; break;
default: throw std::runtime_error("Unexpected value in enumeration \"[object Object]\": " + std::to_string(static_cast<int>(x)));
}
}

inline void from_json(const json & j, Version & x) {
if (j == "1") x = Version::The1;
else { throw std::runtime_error("Input JSON does not conform to schema!"); }
}

inline void to_json(json & j, const Version & x) {
switch (x) {
case Version::The1: j = "1"; break;
default: throw std::runtime_error("Unexpected value in enumeration \"[object Object]\": " + std::to_string(static_cast<int>(x)));
}
}
}
}
}
}

// clang-format on
