// WARNING: This file is automatically generated. Any changes will be lost.
#include "twitch-eventsub-ws/payloads/suspicious-users.hpp"

#include "twitch-eventsub-ws/chrono.hpp"  // IWYU pragma: keep
#include "twitch-eventsub-ws/detail/errors.hpp"
#include "twitch-eventsub-ws/detail/variant.hpp"  // IWYU pragma: keep

#include <boost/json.hpp>

namespace chatterino::eventsub::lib::suspicious_users {

boost::json::result_for<Status, boost::json::value>::type tag_invoke(
    boost::json::try_value_to_tag<Status> /* tag */,
    const boost::json::value &jvRoot)
{
    if (!jvRoot.is_string())
    {
        EVENTSUB_BAIL_HERE(error::Kind::ExpectedString);
    }
    std::string_view eString(jvRoot.get_string());

    using namespace std::string_view_literals;
    if (eString == "none"sv)
    {
        return Status::None;
    }
    if (eString == "active_monitoring"sv)
    {
        return Status::ActiveMonitoring;
    }
    if (eString == "restricted"sv)
    {
        return Status::Restricted;
    }
    return Status::None;
}

boost::json::result_for<Type, boost::json::value>::type tag_invoke(
    boost::json::try_value_to_tag<Type> /* tag */,
    const boost::json::value &jvRoot)
{
    if (!jvRoot.is_string())
    {
        EVENTSUB_BAIL_HERE(error::Kind::ExpectedString);
    }
    std::string_view eString(jvRoot.get_string());

    using namespace std::string_view_literals;
    if (eString == "unknown"sv)
    {
        return Type::Unknown;
    }
    if (eString == "manual"sv)
    {
        return Type::Manual;
    }
    if (eString == "manually_added"sv)
    {
        return Type::Manual;
    }
    if (eString == "ban_evader_detector"sv)
    {
        return Type::BanEvaderDetector;
    }
    if (eString == "shared_channel_ban"sv)
    {
        return Type::SharedChannelBan;
    }
    return Type::Unknown;
}

boost::json::result_for<BanEvasionEvaluation, boost::json::value>::type
    tag_invoke(boost::json::try_value_to_tag<BanEvasionEvaluation> /* tag */,
               const boost::json::value &jvRoot)
{
    if (!jvRoot.is_string())
    {
        EVENTSUB_BAIL_HERE(error::Kind::ExpectedString);
    }
    std::string_view eString(jvRoot.get_string());

    using namespace std::string_view_literals;
    if (eString == "unknown"sv)
    {
        return BanEvasionEvaluation::Unknown;
    }
    if (eString == "possible"sv)
    {
        return BanEvasionEvaluation::Possible;
    }
    if (eString == "likely"sv)
    {
        return BanEvasionEvaluation::Likely;
    }
    return BanEvasionEvaluation::Unknown;
}

}  // namespace chatterino::eventsub::lib::suspicious_users
