import type { SpanAndAnnotation } from './spanAnnotationTypes';
import type { Attributes, SpanStatus, SpanType } from './spanTypes';
import type { DraftTraceContext, MapSchemaToTypes } from './types';
import type { UnionToIntersection } from './typeUtils';
export interface SpanMatcherTags {
    idleCheck?: boolean;
    continueWithErrorStatus?: boolean;
    requiredSpan?: boolean;
    matchingIndex?: number;
}
/**
 * Function type for matching performance entries.
 */
export interface SpanMatcherFn<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT, VariantsT extends string> extends SpanMatcherTags {
    (spanAndAnnotation: SpanAndAnnotation<RelationSchemasT>, context: DraftTraceContext<SelectedRelationNameT, RelationSchemasT, VariantsT>): boolean;
    /** source definition object for debugging (if converted from object) */
    fromDefinition?: SpanMatchDefinitionCombinator<SelectedRelationNameT, RelationSchemasT, VariantsT>;
}
export type NameMatcher<RelationSchemaT> = string | RegExp | ((name: string, inputRelation: MapSchemaToTypes<RelationSchemaT> | undefined) => boolean);
export interface SpanMatchDefinitionCombinator<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT, VariantsT extends string> {
    name?: NameMatcher<RelationSchemasT[SelectedRelationNameT]>;
    performanceEntryName?: NameMatcher<RelationSchemasT[SelectedRelationNameT]>;
    type?: SpanType;
    status?: SpanStatus;
    attributes?: Attributes;
    matchingRelations?: (keyof UnionToIntersection<RelationSchemasT[SelectedRelationNameT]>)[] | boolean;
    occurrence?: number | ((occurrence: number) => boolean);
    isIdle?: boolean;
    label?: string;
    fn?: SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
    oneOf?: SpanMatchDefinition<SelectedRelationNameT, RelationSchemasT, VariantsT>[];
    /**
     * This only has an effect on startSpan and endSpan for defining computed spans
     * It must be defined on the top level matcher definition
     * */
    matchingIndex?: number;
}
export type SpanMatchDefinition<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT, VariantsT extends string> = SpanMatchDefinitionCombinator<SelectedRelationNameT, RelationSchemasT, VariantsT>;
export type SpanMatch<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT, VariantsT extends string> = SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT> | SpanMatchDefinition<SelectedRelationNameT, RelationSchemasT, VariantsT>;
/**
 * The common name of the span to match. Can be a string, RegExp, or function.
 */
export declare function withName<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(value: NameMatcher<RelationSchemasT[SelectedRelationNameT]>): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
export declare function withLabel<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(value: string): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
/**
 * The PerformanceEntry.name of the entry to match. Can be a string, RegExp, or function.
 */
export declare function withPerformanceEntryName<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(value: NameMatcher<RelationSchemasT[SelectedRelationNameT]>): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
export declare function withType<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(value: SpanType): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
export declare function withStatus<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(value: SpanStatus): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
/**
 * The subset of attributes (metadata) to match against the span.
 */
export declare function withAttributes<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT, const VariantsT extends string>(attrs: Attributes): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
/**
 * A list of keys of trace's relations to match against the span's.
 */
export declare function withMatchingRelations<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(keys?: NoInfer<keyof UnionToIntersection<RelationSchemasT[SelectedRelationNameT]>>[] | true): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
/**
 * The occurrence of the span with the same name within the operation.
 */
export declare function withOccurrence<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(value: number | ((occurrence: number) => boolean)): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
export declare function withComponentRenderCount<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(name: string, renderCount: number): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
/**
 * only applicable for component-lifecycle entries
 */
export declare function whenIdle<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(value?: boolean): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
/**
 * Only applicable for 'requiredSpans' list: it will opt-out of the default behavior,
 * which interrupts the trace if the requiredSpan has an error status.
 */
export declare function continueWithErrorStatus<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
export declare function withAllConditions<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(...matchers: SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>[]): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
export declare function withOneOfConditions<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(...matchers: SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>[]): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
export declare function not<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(matcher: SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
export declare function fromDefinition<const SelectedRelationNameT extends keyof RelationSchemasT, const RelationSchemasT, const VariantsT extends string>(definition: SpanMatchDefinition<SelectedRelationNameT, RelationSchemasT, VariantsT>): SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>;
