// 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/components/channel_message_counts.fbs".

#pragma once

#include "../collection.hpp"
#include "../datatypes/channel_count_pair.hpp"
#include "../result.hpp"

#include <cstdint>
#include <memory>
#include <utility>

namespace arrow {
    class Array;
    class DataType;
    class ListBuilder;
} // namespace arrow

namespace rerun::components {
    /// **Component**: A mapping of channel IDs to their respective message counts.
    ///
    /// Used in MCAP statistics to track how many messages were recorded per channel.
    ///
    /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
    ///
    struct ChannelMessageCounts {
        /// The channel ID to message count pairs.
        rerun::Collection<rerun::datatypes::ChannelCountPair> counts;

      public:
        ChannelMessageCounts() = default;

        ChannelMessageCounts(rerun::Collection<rerun::datatypes::ChannelCountPair> counts_)
            : counts(std::move(counts_)) {}

        ChannelMessageCounts& operator=(
            rerun::Collection<rerun::datatypes::ChannelCountPair> counts_
        ) {
            counts = std::move(counts_);
            return *this;
        }
    };
} // namespace rerun::components

namespace rerun {
    template <typename T>
    struct Loggable;

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

        /// Returns the arrow data type this type corresponds to.
        static const std::shared_ptr<arrow::DataType>& arrow_datatype();

        /// Serializes an array of `rerun::components::ChannelMessageCounts` into an arrow array.
        static Result<std::shared_ptr<arrow::Array>> to_arrow(
            const components::ChannelMessageCounts* instances, size_t num_instances
        );

        /// Fills an arrow array builder with an array of this type.
        static rerun::Error fill_arrow_array_builder(
            arrow::ListBuilder* builder, const components::ChannelMessageCounts* elements,
            size_t num_elements
        );
    };
} // namespace rerun
