/**
 * Distributed Tracing Types
 * Mirrors the types defined in edge function logger
 */

export interface Span {
  spanId: string;
  traceId: string;
  parentSpanId?: string;
  name: string;
  kind: 'SERVER' | 'CLIENT' | 'INTERNAL' | 'DATABASE';
  startTime: number;
  endTime?: number;
  duration?: number;
  attributes: Record<string, unknown>;
  events: SpanEvent[];
  status: 'ok' | 'error' | 'unset';
  error?: {
    type: string;
    message: string;
    stack?: string;
  };
}

export interface SpanEvent {
  timestamp: number;
  name: string;
  attributes?: Record<string, unknown>;
}

export interface SpanContext {
  traceId: string;
  spanId: string;
  traceFlags?: number;
}
