//! Shared test utilities for OTLP parsing tests

use super::otlp_types::{AnyValueTyped, KeyValue, LogRecord};

/// Create a KeyValue with a string value
pub fn make_kv(key: &str, value: &str) -> KeyValue {
    KeyValue {
        key: key.to_string(),
        value: AnyValueTyped {
            string_value: Some(value.to_string()),
            int_value: None,
            double_value: None,
        },
    }
}

/// Create a KeyValue with an i64 value
pub fn make_kv_int(key: &str, value: i64) -> KeyValue {
    KeyValue {
        key: key.to_string(),
        value: AnyValueTyped {
            string_value: None,
            int_value: Some(value),
            double_value: None,
        },
    }
}

/// Create a LogRecord with the given event name and attributes
pub fn make_log_record(event_name: &str, attrs: Vec<KeyValue>) -> LogRecord {
    let mut all_attrs = vec![make_kv("event.name", event_name)];
    all_attrs.extend(attrs);
    LogRecord {
        time_unix_nano: Some("1700000000000000000".to_string()),
        attributes: Some(all_attrs),
    }
}
