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

#pragma once

#include "../../blueprint/datatypes/text_log_column.hpp"
#include "../../result.hpp"

#include <cstdint>
#include <memory>

namespace rerun::blueprint::components {
    /// **Component**: A text log column
    ///
    /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
    ///
    struct TextLogColumn {
        /// The text log column.
        rerun::blueprint::datatypes::TextLogColumn text_log_column;

      public:
        TextLogColumn() = default;

        TextLogColumn(rerun::blueprint::datatypes::TextLogColumn text_log_column_)
            : text_log_column(text_log_column_) {}

        TextLogColumn& operator=(rerun::blueprint::datatypes::TextLogColumn text_log_column_) {
            text_log_column = text_log_column_;
            return *this;
        }

        /// Cast to the underlying TextLogColumn datatype
        operator rerun::blueprint::datatypes::TextLogColumn() const {
            return text_log_column;
        }
    };
} // namespace rerun::blueprint::components

namespace rerun {
    static_assert(
        sizeof(rerun::blueprint::datatypes::TextLogColumn) ==
        sizeof(blueprint::components::TextLogColumn)
    );

    /// \private
    template <>
    struct Loggable<blueprint::components::TextLogColumn> {
        static constexpr std::string_view ComponentType =
            "rerun.blueprint.components.TextLogColumn";

        /// Returns the arrow data type this type corresponds to.
        static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
            return Loggable<rerun::blueprint::datatypes::TextLogColumn>::arrow_datatype();
        }

        /// Serializes an array of `rerun::blueprint:: components::TextLogColumn` into an arrow array.
        static Result<std::shared_ptr<arrow::Array>> to_arrow(
            const blueprint::components::TextLogColumn* instances, size_t num_instances
        ) {
            if (num_instances == 0) {
                return Loggable<rerun::blueprint::datatypes::TextLogColumn>::to_arrow(nullptr, 0);
            } else if (instances == nullptr) {
                return rerun::Error(
                    ErrorCode::UnexpectedNullArgument,
                    "Passed array instances is null when num_elements> 0."
                );
            } else {
                return Loggable<rerun::blueprint::datatypes::TextLogColumn>::to_arrow(
                    &instances->text_log_column,
                    num_instances
                );
            }
        }
    };
} // namespace rerun
