#pragma once
// #include "./basic_types.hpp"

namespace lsp::protocol
{

    inline LSPAny::LSPAny() :
        value(nullptr) {}

    inline LSPAny::LSPAny(const LSPAny& other) :
        value(other.value) {}

    inline LSPAny::LSPAny(LSPAny&& other) noexcept :
        value(std::move(other.value)) {}

    inline LSPAny::LSPAny(const LSPObject& val) :
        value(val) {}

    inline LSPAny::LSPAny(LSPObject&& val) :
        value(std::move(val)) {}

    inline LSPAny::LSPAny(const LSPArray& val) :
        value(val) {}

    inline LSPAny::LSPAny(LSPArray&& val) :
        value(std::move(val)) {}

    inline LSPAny::LSPAny(const string& val) :
        value(val) {}

    inline LSPAny::LSPAny(string&& val) :
        value(std::move(val)) {}

    inline LSPAny::LSPAny(const char* val) :
        value(string(val)) {}

    inline LSPAny::LSPAny(float val) :
        value(static_cast<decimal>(val)) {}

    inline LSPAny::LSPAny(double val) :
        value(val) {}

    inline LSPAny::LSPAny(long double val) :
        value(static_cast<decimal>(val)) {}

    inline LSPAny::LSPAny(boolean val) :
        value(val) {}

    inline LSPAny::LSPAny(std::nullptr_t) :
        value(nullptr) {}

    // 赋值操作符
    inline LSPAny& LSPAny::operator=(const LSPAny& other)
    {
        value = other.value;
        return *this;
    }

    inline LSPAny& LSPAny::operator=(LSPAny&& other) noexcept
    {
        value = std::move(other.value);
        return *this;
    }

    inline LSPAny& LSPAny::operator=(const LSPObject& val)
    {
        value = val;
        return *this;
    }

    inline LSPAny& LSPAny::operator=(LSPObject&& val)
    {
        value = std::move(val);
        return *this;
    }

    inline LSPAny& LSPAny::operator=(const LSPArray& val)
    {
        value = val;
        return *this;
    }

    inline LSPAny& LSPAny::operator=(LSPArray&& val)
    {
        value = std::move(val);
        return *this;
    }

    inline LSPAny& LSPAny::operator=(const string& val)
    {
        value = val;
        return *this;
    }

    inline LSPAny& LSPAny::operator=(string&& val)
    {
        value = std::move(val);
        return *this;
    }

    inline LSPAny& LSPAny::operator=(const char* val)
    {
        value = string(val);
        return *this;
    }

    inline LSPAny& LSPAny::operator=(float val)
    {
        value = static_cast<decimal>(val);
        return *this;
    }

    inline LSPAny& LSPAny::operator=(double val)
    {
        value = val;
        return *this;
    }

    inline LSPAny& LSPAny::operator=(long double val)
    {
        value = static_cast<decimal>(val);
        return *this;
    }

    inline LSPAny& LSPAny::operator=(boolean val)
    {
        value = val;
        return *this;
    }

    inline LSPAny& LSPAny::operator=(std::nullptr_t)
    {
        value = nullptr;
        return *this;
    }

}
