// 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/archetypes/text_log_rows.fbs".

#pragma once

#include "../../collection.hpp"
#include "../../component_batch.hpp"
#include "../../component_column.hpp"
#include "../../components/text_log_level.hpp"
#include "../../result.hpp"

#include <cstdint>
#include <optional>
#include <utility>
#include <vector>

namespace rerun::blueprint::archetypes {
    /// **Archetype**: Configuration of the text log rows.
    ///
    /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
    ///
    struct TextLogRows {
        /// Log levels to display.
        ///
        /// Defaults to showing all logged levels.
        std::optional<ComponentBatch> filter_by_log_level;

      public:
        /// The name of the archetype as used in `ComponentDescriptor`s.
        static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.TextLogRows";

        /// `ComponentDescriptor` for the `filter_by_log_level` field.
        static constexpr auto Descriptor_filter_by_log_level = ComponentDescriptor(
            ArchetypeName, "TextLogRows:filter_by_log_level",
            Loggable<rerun::components::TextLogLevel>::ComponentType
        );

      public:
        TextLogRows() = default;
        TextLogRows(TextLogRows&& other) = default;
        TextLogRows(const TextLogRows& other) = default;
        TextLogRows& operator=(const TextLogRows& other) = default;
        TextLogRows& operator=(TextLogRows&& other) = default;

        /// Update only some specific fields of a `TextLogRows`.
        static TextLogRows update_fields() {
            return TextLogRows();
        }

        /// Clear all the fields of a `TextLogRows`.
        static TextLogRows clear_fields();

        /// Log levels to display.
        ///
        /// Defaults to showing all logged levels.
        TextLogRows with_filter_by_log_level(
            const Collection<rerun::components::TextLogLevel>& _filter_by_log_level
        ) && {
            filter_by_log_level =
                ComponentBatch::from_loggable(_filter_by_log_level, Descriptor_filter_by_log_level)
                    .value_or_throw();
            return std::move(*this);
        }

        /// Partitions the component data into multiple sub-batches.
        ///
        /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
        /// instead, via `ComponentBatch::partitioned`.
        ///
        /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
        ///
        /// The specified `lengths` must sum to the total length of the component batch.
        Collection<ComponentColumn> columns(const Collection<uint32_t>& lengths_);

        /// Partitions the component data into unit-length sub-batches.
        ///
        /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
        /// where `n` is automatically guessed.
        Collection<ComponentColumn> columns();
    };

} // namespace rerun::blueprint::archetypes

namespace rerun {
    /// \private
    template <typename T>
    struct AsComponents;

    /// \private
    template <>
    struct AsComponents<blueprint::archetypes::TextLogRows> {
        /// Serialize all set component batches.
        static Result<Collection<ComponentBatch>> as_batches(
            const blueprint::archetypes::TextLogRows& archetype
        );
    };
} // namespace rerun
