// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs
// Based on "crates/re_types/definitions/rerun/archetypes/text_log.fbs".

#include "text_log.hpp"

#include "../component_batch_adapter_builtins.hpp"

namespace rerun {
    namespace archetypes {
        const char TextLog::INDICATOR_COMPONENT_NAME[] = "rerun.components.TextLogIndicator";
    }

    Result<std::vector<SerializedComponentBatch>> AsComponents<archetypes::TextLog>::serialize(
        const archetypes::TextLog& archetype
    ) {
        using namespace archetypes;
        std::vector<SerializedComponentBatch> cells;
        cells.reserve(3);

        {
            auto result = ComponentBatch<rerun::components::Text>(archetype.text).serialize();
            RR_RETURN_NOT_OK(result.error);
            cells.emplace_back(std::move(result.value));
        }
        if (archetype.level.has_value()) {
            auto result = ComponentBatch<rerun::components::TextLogLevel>(archetype.level.value())
                              .serialize();
            RR_RETURN_NOT_OK(result.error);
            cells.emplace_back(std::move(result.value));
        }
        if (archetype.color.has_value()) {
            auto result =
                ComponentBatch<rerun::components::Color>(archetype.color.value()).serialize();
            RR_RETURN_NOT_OK(result.error);
            cells.emplace_back(std::move(result.value));
        }
        {
            auto result = ComponentBatch<TextLog::IndicatorComponent>(TextLog::IndicatorComponent())
                              .serialize();
            RR_RETURN_NOT_OK(result.error);
            cells.emplace_back(std::move(result.value));
        }

        return cells;
    }
} // namespace rerun
