#include "JsonExports.hpp"

nlohmann::json TSE::ExportColor(Color &color)
{
    using json = nlohmann::json;
    json exp;
    exp["r"] = color.r;
    exp["g"] = color.g;
    exp["b"] = color.b;
    exp["a"] = color.a;
    return exp;
}

nlohmann::json TSE::ExportVector2(Vector2 &vec2)
{
    using json = nlohmann::json;
    json exp;
    exp["x"] = vec2.x;
    exp["y"] = vec2.y;
    return exp;
}

nlohmann::json TSE::ExportVector3(Vector3 &vec3)
{
    using json = nlohmann::json;
    json exp;
    exp["x"] = vec3.x;
    exp["y"] = vec3.y;
    exp["z"] = vec3.z;
    return exp;
}

nlohmann::json TSE::ExportVector4(Vector4 &vec4)
{
    using json = nlohmann::json;
    json exp;
    exp["x"] = vec4.x;
    exp["y"] = vec4.y;
    exp["z"] = vec4.z;
    exp["w"] = vec4.w;
    return exp;
}

TSE::Color TSE::ImportColor(nlohmann::json json)
{
    Color imp;
    imp.r = json["r"];
    imp.g = json["g"];
    imp.b = json["b"];
    imp.a = json["a"];
    return imp;
}

TSE::Vector2 TSE::ImportVector2(nlohmann::json json)
{
    Vector2 imp;
    imp.x = json["x"];
    imp.y = json["y"];
    return imp;
}

TSE::Vector3 TSE::ImportVector3(nlohmann::json json)
{
    Vector3 imp;
    imp.x = json["x"];
    imp.y = json["y"];
    imp.z = json["z"];
    return imp;
}

TSE::Vector4 TSE::ImportVector4(nlohmann::json json)
{
    Vector4 imp;
    imp.x = json["x"];
    imp.y = json["y"];
    imp.z = json["z"];
    imp.w = json["w"];
    return imp;
}
