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

#include "container_blueprint.hpp"

#include "../../collection_adapter_builtins.hpp"

namespace rerun::blueprint::archetypes {}

namespace rerun {

    Result<std::vector<ComponentBatch>>
        AsComponents<blueprint::archetypes::ContainerBlueprint>::serialize(
            const blueprint::archetypes::ContainerBlueprint& archetype
        ) {
        using namespace blueprint::archetypes;
        std::vector<ComponentBatch> cells;
        cells.reserve(9);

        {
            auto result = ComponentBatch::from_loggable(archetype.container_kind);
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.display_name.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.display_name.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.contents.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.contents.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.col_shares.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.col_shares.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.row_shares.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.row_shares.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.active_tab.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.active_tab.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.visible.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.visible.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.grid_columns.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.grid_columns.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        {
            auto indicator = ContainerBlueprint::IndicatorComponent();
            auto result = ComponentBatch::from_loggable(indicator);
            RR_RETURN_NOT_OK(result.error);
            cells.emplace_back(std::move(result.value));
        }

        return cells;
    }
} // namespace rerun
