#pragma once

// 定义管道上下文 包含设备ID、端点、时间戳、协议提示、跟踪ID、有效载荷、有效载荷大小
#include <cstddef>
#include <cstdint>

#include <QDateTime>
#include <QMetaType>
#include <QString>

#include "message_bus/pipeline/PayloadRef.h"

namespace softbus::message_bus::pipeline
{

enum class FrameKind
{
    StreamChunk,
    CompleteFrame,
};

enum class BusDirection
{
    Unknown,
    Upstream,
    Downstream,
};

struct PipelineContext
{
    int deviceId{-1}; // 设备ID
    QString stableKey;
    QString endpoint; // 端点
    QDateTime timestamp{QDateTime::currentDateTimeUtc()}; // 时间戳
    QString protocolHint; // 协议提示
    QString traceId; // 跟踪ID

    PayloadRef payload; // 有效载荷
    std::size_t payloadSize{0}; // 有效载荷大小

    FrameKind frameKind{FrameKind::StreamChunk};
    BusDirection direction{BusDirection::Unknown};
    std::uint64_t frameSeq{0};

};

} // namespace softbus::message_bus::pipeline

Q_DECLARE_METATYPE(softbus::message_bus::pipeline::PipelineContext)
