import { Span } from '@opentelemetry/api';
import { Resource } from '@opentelemetry/resources';
import { T as TraceContext, A as AttributeValue } from './trace-context-t5X1AP-e.js';

interface UserAttrs {
    id?: string;
    email?: string;
    name?: string;
    fullName?: string;
    hash?: string;
    roles?: string[];
}
interface SessionAttrs {
    id?: string;
    previousId?: string;
}
interface DeviceAttrs {
    id?: string;
    manufacturer?: string;
    modelIdentifier?: string;
    modelName?: string;
}
interface HTTPServerAttrs {
    method?: string;
    route?: string;
    statusCode?: number;
    bodySize?: number;
    requestSize?: number;
    responseSize?: number;
    resendCount?: number;
}
interface HTTPClientAttrs {
    method?: string;
    url?: string;
    statusCode?: number;
}
interface DBAttrs {
    system?: string;
    /** Database name - maps to db.namespace (db.name is deprecated) */
    name?: string;
    /** Explicit namespace - takes precedence over name if both provided */
    namespace?: string;
    operation?: string;
    collectionName?: string;
    statement?: string;
    querySummary?: string;
    queryText?: string;
    responseStatus?: string | number;
    rowsReturned?: number;
}
interface ServiceAttrs {
    name?: string;
    instance?: string;
    version?: string;
}
interface NetworkAttrs {
    protocolName?: string;
    protocolVersion?: string;
    peerAddress?: string;
    peerPort?: number;
    transport?: string;
    connectionId?: string;
}
interface ErrorAttrs {
    type?: string;
    message?: string;
    stackTrace?: string;
    code?: string | number;
}
interface FeatureFlagAttrs {
    key?: string;
    provider?: string;
    variant?: string;
}
interface MessagingAttrs {
    system?: string;
    destination?: string;
    operation?: 'publish' | 'receive' | 'process';
    messageId?: string;
    conversationId?: string;
}
interface CloudAttrs {
    provider?: string;
    accountId?: string;
    region?: string;
    availabilityZone?: string;
    platform?: string;
}
interface ServerAddressAttrs {
    address?: string;
    port?: number;
    socketAddress?: string;
}
interface URLAttrs {
    scheme?: string;
    full?: string;
    path?: string;
    query?: string;
    fragment?: string;
}
interface PeerAttrs {
    service?: string;
    address?: string;
    port?: number;
}
interface ProcessAttrs {
    pid?: number;
    executablePath?: string;
    command?: string;
    owner?: string;
}
interface ContainerAttrs {
    id?: string;
    name?: string;
    image?: string;
    tag?: string;
}
interface K8sAttrs {
    podName?: string;
    namespace?: string;
    deploymentName?: string;
    state?: string;
}
interface FaaSAttrs {
    name?: string;
    version?: string;
    instance?: string;
    execution?: string;
    coldstart?: boolean;
}
interface ThreadAttrs {
    id?: number;
    name?: string;
}
interface GenAIAttrs {
    system?: string;
    requestModel?: string;
    responseModel?: string;
    operationName?: 'chat' | 'completion' | 'embedding';
    provider?: string;
}
interface RPCAttrs {
    system?: string;
    service?: string;
    method?: string;
    message?: string;
}
interface GraphQLAttrs {
    document?: string;
    operationName?: string;
    type?: 'query' | 'mutation' | 'subscription';
}
interface ClientAttrs {
    address?: string;
    port?: number;
    socketAddress?: string;
}
interface DeploymentAttrs {
    environment?: string;
    id?: string;
}
interface OTelAttrs {
    libraryName?: string;
    libraryVersion?: string;
    schemaUrl?: string;
}
interface CodeAttrs {
    namespace?: string;
    filepath?: string;
    function?: string;
    class?: string;
    method?: string;
    repository?: string;
    revision?: string;
}
interface ExceptionAttrs {
    escaped?: boolean;
    message?: string;
    stackTrace?: string;
    type?: string;
    moduleName?: string;
}
interface TLSAttrs {
    protocolVersion?: string;
    cipher?: string;
    curveName?: string;
    resumed?: boolean;
}

/**
 * Attribute builders for constructing OpenTelemetry attributes
 * Provides both key builders (Pattern A) and object builders (Pattern B)
 *
 * @example Pattern A: Key builders
 * ```typescript
 * attrs.user.id('123')                              // { 'user.id': '123' }
 * attrs.user.email('user@example.com')                 // { 'user.email': 'user@example.com' }
 * attrs.http.request.method('GET')                   // { 'http.request.method': 'GET' }
 * attrs.http.response.statusCode(200)                 // { 'http.response.status_code': 200 }
 * ```
 *
 * @example Pattern B: Object builders
 * ```typescript
 * attrs.user({ id: '123', email: 'user@example.com' })
 * attrs.http.server({ method: 'GET', route: '/users/:id', statusCode: 200 })
 * attrs.db.client({ system: 'postgresql', operation: 'SELECT', collectionName: 'users' })
 * ```
 */

declare const attrs: {
    readonly user: {
        readonly id: (value: string) => {
            "user.id": string;
        };
        readonly email: (value: string) => {
            "user.email": string;
        };
        readonly name: (value: string) => {
            "user.name": string;
        };
        readonly fullName: (value: string) => {
            "user.full_name": string;
        };
        readonly hash: (value: string) => {
            "user.hash": string;
        };
        readonly roles: (value: string[]) => {
            "user.roles": string[];
        };
        readonly data: (data: UserAttrs) => Record<string, unknown>;
    };
    readonly session: {
        readonly id: (value: string) => {
            "session.id": string;
        };
        readonly previousId: (value: string) => {
            "session.previous_id": string;
        };
        readonly data: (data: SessionAttrs) => Record<string, unknown>;
    };
    readonly device: {
        readonly id: (value: string) => {
            "device.id": string;
        };
        readonly manufacturer: (value: string) => {
            "device.manufacturer": string;
        };
        readonly modelIdentifier: (value: string) => {
            "device.model.identifier": string;
        };
        readonly modelName: (value: string) => {
            "device.model.name": string;
        };
        readonly data: (data: DeviceAttrs) => Record<string, unknown>;
    };
    readonly http: {
        readonly request: {
            readonly method: (value: string) => {
                "http.request.method": string;
            };
            readonly methodOriginal: (value: string) => {
                "http.request.method_original": string;
            };
            readonly resendCount: (value: number) => {
                "http.request.resend_count": number;
            };
            readonly size: (value: number) => {
                "http.request.size": number;
            };
            readonly bodySize: (value: number) => {
                "http.request.body.size": number;
            };
        };
        readonly response: {
            readonly statusCode: (value: number) => {
                "http.response.status_code": number;
            };
            readonly size: (value: number) => {
                "http.response.size": number;
            };
            readonly bodySize: (value: number) => {
                "http.response.body.size": number;
            };
        };
        readonly route: (value: string) => {
            "http.route": string;
        };
        readonly connectionState: (value: string) => {
            "http.connection.state": string;
        };
        readonly server: (data: HTTPServerAttrs) => Record<string, unknown>;
        readonly client: (data: HTTPClientAttrs) => Record<string, unknown>;
    };
    readonly db: {
        readonly client: {
            readonly system: (value: string) => {
                "db.system.name": string;
            };
            readonly operation: (value: string) => {
                "db.operation.name": string;
            };
            readonly collectionName: (value: string) => {
                "db.collection.name": string;
            };
            readonly namespace: (value: string) => {
                "db.namespace": string;
            };
            readonly statement: (value: string) => {
                "db.statement": string;
            };
            readonly querySummary: (value: string) => {
                "db.query.summary": string;
            };
            readonly queryText: (value: string) => {
                "db.query.text": string;
            };
            readonly responseStatus: (value: string | number) => {
                "db.response.status_code": string | number;
            };
            readonly rowsReturned: (value: number) => {
                "db.response.returned_rows": number;
            };
            readonly data: (data: DBAttrs) => Record<string, unknown>;
        };
    };
    readonly service: {
        readonly name: (value: string) => {
            "service.name": string;
        };
        readonly instance: (value: string) => {
            "service.instance.id": string;
        };
        readonly version: (value: string) => {
            "service.version": string;
        };
        readonly data: (data: ServiceAttrs) => Record<string, unknown>;
    };
    readonly network: {
        readonly peerAddress: (value: string) => {
            "network.peer.address": string;
        };
        readonly peerPort: (value: number) => {
            "network.peer.port": number;
        };
        readonly transport: (value: string) => {
            "network.transport": string;
        };
        readonly protocolName: (value: string) => {
            "network.protocol.name": string;
        };
        readonly protocolVersion: (value: string) => {
            "network.protocol.version": string;
        };
        readonly data: (data: NetworkAttrs) => Record<string, unknown>;
    };
    readonly server: {
        readonly address: (value: string) => {
            "server.address": string;
        };
        readonly port: (value: number) => {
            "server.port": number;
        };
        readonly socketAddress: (value: string) => {
            "server.socket.address": string;
        };
        readonly data: (data: ServerAddressAttrs) => Record<string, unknown>;
    };
    readonly url: {
        readonly scheme: (value: string) => {
            "url.scheme": string;
        };
        readonly full: (value: string) => {
            "url.full": string;
        };
        readonly path: (value: string) => {
            "url.path": string;
        };
        readonly query: (value: string) => {
            "url.query": string;
        };
        readonly fragment: (value: string) => {
            "url.fragment": string;
        };
        readonly data: (data: URLAttrs) => Record<string, unknown>;
    };
    readonly error: {
        readonly type: (value: string) => {
            "error.type": string;
        };
        readonly message: (value: string) => {
            "error.message": string;
        };
        readonly stackTrace: (value: string) => {
            "error.stack": string;
        };
        readonly code: (value: string | number) => {
            "error.code": string | number;
        };
        readonly data: (data: ErrorAttrs) => Record<string, unknown>;
    };
    readonly exception: {
        readonly escaped: (value: boolean) => {
            "exception.escaped": boolean;
        };
        readonly message: (value: string) => {
            "exception.message": string;
        };
        readonly stackTrace: (value: string) => {
            "exception.stacktrace": string;
        };
        readonly type: (value: string) => {
            "exception.type": string;
        };
        readonly moduleName: (value: string) => {
            "exception.module": string;
        };
        readonly data: (data: ExceptionAttrs) => Record<string, unknown>;
    };
    readonly process: {
        readonly pid: (value: number) => {
            "process.pid": number;
        };
        readonly executablePath: (value: string) => {
            "process.executable.path": string;
        };
        readonly command: (value: string) => {
            "process.command": string;
        };
        readonly owner: (value: string) => {
            "process.owner": string;
        };
        readonly data: (data: ProcessAttrs) => Record<string, unknown>;
    };
    readonly thread: {
        readonly id: (value: number) => {
            "thread.id": number;
        };
        readonly name: (value: string) => {
            "thread.name": string;
        };
    };
    readonly container: {
        readonly id: (value: string) => {
            "container.id": string;
        };
        readonly name: (value: string) => {
            "container.name": string;
        };
        readonly image: (value: string) => {
            "container.image.name": string;
        };
        readonly tag: (value: string) => {
            "container.image.tag": string;
        };
        readonly data: (data: ContainerAttrs) => Record<string, unknown>;
    };
    readonly k8s: {
        readonly podName: (value: string) => {
            "k8s.pod.name": string;
        };
        readonly namespaceName: (value: string) => {
            "k8s.namespace.name": string;
        };
        readonly deploymentName: (value: string) => {
            "k8s.deployment.name": string;
        };
        readonly state: (value: string) => {
            "k8s.state.name": string;
        };
    };
    readonly cloud: {
        readonly provider: (value: string) => {
            "cloud.provider": string;
        };
        readonly accountId: (value: string) => {
            "cloud.account.id": string;
        };
        readonly region: (value: string) => {
            "cloud.region": string;
        };
        readonly availabilityZone: (value: string) => {
            "cloud.availability_zone": string;
        };
        readonly platform: (value: string) => {
            "cloud.platform": string;
        };
        readonly data: (data: CloudAttrs) => Record<string, unknown>;
    };
    readonly faas: {
        readonly name: (value: string) => {
            "faas.name": string;
        };
        readonly version: (value: string) => {
            "faas.version": string;
        };
        readonly instance: (value: string) => {
            "faas.instance": string;
        };
        readonly execution: (value: string) => {
            "faas.execution": string;
        };
        readonly coldstart: (value: boolean) => {
            "faas.coldstart": boolean;
        };
    };
    readonly featureFlag: {
        readonly key: (value: string) => {
            "feature.flag.key": string;
        };
        readonly provider: (value: string) => {
            "feature.flag.provider_name": string;
        };
        readonly variant: (value: string) => {
            "feature.flag.variant.name": string;
        };
    };
    readonly messaging: {
        readonly system: (value: string) => {
            "messaging.system": string;
        };
        readonly destination: (value: string) => {
            "messaging.destination.name": string;
        };
        readonly operation: (value: "publish" | "receive" | "process") => {
            "messaging.operation": "publish" | "receive" | "process";
        };
        readonly messageId: (value: string) => {
            "messaging.message.id": string;
        };
        readonly conversationId: (value: string) => {
            "messaging.conversation_id": string;
        };
        readonly data: (data: MessagingAttrs) => Record<string, unknown>;
    };
    readonly genAI: {
        readonly system: (value: string) => {
            "gen.ai.system": string;
        };
        readonly requestModel: (value: string) => {
            "gen.ai.request.model": string;
        };
        readonly responseModel: (value: string) => {
            "gen.ai.response.model": string;
        };
        readonly operationName: (value: "chat" | "completion" | "embedding") => {
            "gen.ai.operation.name": "chat" | "completion" | "embedding";
        };
        readonly usagePromptTokens: (value: number) => {
            "gen.ai.usage.prompt_tokens": number;
        };
        readonly usageCompletionTokens: (value: number) => {
            "gen.ai.usage.completion_tokens": number;
        };
        readonly provider: (value: string) => {
            "gen.ai.provider": string;
        };
    };
    readonly rpc: {
        readonly system: (value: string) => {
            "rpc.system": string;
        };
        readonly service: (value: string) => {
            "rpc.service": string;
        };
        readonly method: (value: string) => {
            "rpc.method": string;
        };
        readonly grpcStatusCode: (value: number) => {
            "rpc.grpc.status_code": number;
        };
    };
    readonly graphql: {
        readonly document: (value: string) => {
            "graphql.document": string;
        };
        readonly operationName: (value: string) => {
            "graphql.operation.name": string;
        };
        readonly operationType: (value: "query" | "mutation" | "subscription") => {
            "graphql.operation.type": "query" | "mutation" | "subscription";
        };
    };
    readonly otel: {
        readonly libraryName: (value: string) => {
            "otel.library.name": string;
        };
        readonly libraryVersion: (value: string) => {
            "otel.library.version": string;
        };
        readonly statusCode: (value: string) => {
            "otel.status_code": string;
        };
    };
    readonly code: {
        readonly namespace: (value: string) => {
            "code.namespace": string;
        };
        readonly filepath: (value: string) => {
            "code.filepath": string;
        };
        readonly function: (value: string) => {
            "code.function": string;
        };
        readonly class: (value: string) => {
            "code.class": string;
        };
        readonly method: (value: string) => {
            "code.method": string;
        };
        readonly column: (value: string) => {
            "code.column": string;
        };
        readonly lineNumber: (value: number) => {
            "code.lineno": number;
        };
        readonly repository: (value: string) => {
            "code.repository": string;
        };
        readonly revision: (value: string) => {
            "code.revision": string;
        };
    };
    readonly tls: {
        readonly protocolVersion: (value: string) => {
            "tls.protocol.version": string;
        };
        readonly cipher: (value: string) => {
            "tls.cipher": string;
        };
        readonly curveName: (value: string) => {
            "tls.curve.name": string;
        };
        readonly resumed: (value: boolean) => {
            "tls.resumed": boolean;
        };
    };
};

/**
 * Attribute validation, PII detection, and guardrails
 * Provides safe-by-default attribute handling with configurable policies
 */
interface AttributeGuardrails {
    /** How to handle PII in attributes */
    pii?: 'allow' | 'redact' | 'hash' | 'block';
    /** Maximum length for attribute values */
    maxLength?: number;
    /** Validate enum values against known values */
    validateEnum?: boolean;
    /** Log warnings for deprecated attributes instead of throwing */
    warnDeprecated?: boolean;
    /** Custom deprecation warnings */
    deprecatedWarnings?: Record<string, string>;
}
interface AttributePolicy {
    guardrails?: AttributeGuardrails;
    /** Custom deprecation warnings for specific attributes */
    deprecatedWarnings?: Record<string, string>;
}
declare function validateAttribute(key: string, value: unknown, policy?: AttributePolicy): unknown;
declare function checkDeprecatedAttribute(key: string, policy?: AttributePolicy): string | null;
declare function autoRedactPII(attributes: Record<string, unknown>, policy?: AttributePolicy): Record<string, unknown>;
declare function defaultGuardrails(): AttributeGuardrails;

declare function setUser(spanOrContext: Span | TraceContext, data: UserAttrs, guardrails?: AttributePolicy): void;
declare function setSession(spanOrContext: Span | TraceContext, data: SessionAttrs, guardrails?: AttributePolicy): void;
declare function setDevice(spanOrContext: Span | TraceContext, data: DeviceAttrs, guardrails?: AttributePolicy): void;
declare function httpServer(spanOrContext: Span | TraceContext, data: HTTPServerAttrs, guardrails?: AttributePolicy): void;
declare function httpClient(spanOrContext: Span | TraceContext, data: HTTPClientAttrs, guardrails?: AttributePolicy): void;
declare function dbClient(spanOrContext: Span | TraceContext, data: DBAttrs, guardrails?: AttributePolicy): void;
/**
 * Merge service attributes into a Resource and return a new Resource.
 *
 * Resource.attributes is readonly, so this function returns a new merged
 * Resource rather than mutating the input.
 *
 * @param resource - The existing resource to merge with
 * @param data - Service attributes to add
 * @returns A new Resource with the merged attributes
 *
 * @example
 * ```typescript
 * const baseResource = Resource.default();
 * const enrichedResource = mergeServiceResource(baseResource, {
 *   name: 'my-service',
 *   version: '1.0.0',
 * });
 * ```
 */
declare function mergeServiceResource(resource: Resource, data: ServiceAttrs): Resource;
declare function identify(spanOrContext: Span | TraceContext, data: {
    user?: UserAttrs;
    session?: SessionAttrs;
    device?: DeviceAttrs;
}, guardrails?: AttributePolicy): void;
declare function request(spanOrContext: Span | TraceContext, data: HTTPServerAttrs & {
    clientIp?: string;
}, guardrails?: AttributePolicy): void;
declare function setError(spanOrContext: Span | TraceContext, data: ErrorAttrs, guardrails?: AttributePolicy): void;
declare function setException(spanOrContext: Span | TraceContext, data: ExceptionAttrs, guardrails?: AttributePolicy): void;

/**
 * Attribute utility functions
 */

type AttributeSetter = {
    setAttributes: (attrs: Record<string, AttributeValue>) => void;
};
declare function mergeAttrs(...attrSets: Array<Record<string, unknown> | undefined>): Record<string, unknown>;
declare function safeSetAttributes(span: AttributeSetter, attrs: Record<string, unknown>, policy?: AttributePolicy): void;

export { type AttributePolicy as A, safeSetAttributes as B, type ClientAttrs as C, type DBAttrs as D, type ErrorAttrs as E, type FaaSAttrs as F, type GenAIAttrs as G, type HTTPClientAttrs as H, setDevice as I, setError as J, type K8sAttrs as K, setException as L, type MessagingAttrs as M, type NetworkAttrs as N, type OTelAttrs as O, type PeerAttrs as P, setSession as Q, type RPCAttrs as R, type SessionAttrs as S, type TLSAttrs as T, type UserAttrs as U, setUser as V, validateAttribute as W, type AttributeGuardrails as a, type CloudAttrs as b, type CodeAttrs as c, type ContainerAttrs as d, type DeploymentAttrs as e, type DeviceAttrs as f, type ExceptionAttrs as g, type FeatureFlagAttrs as h, type GraphQLAttrs as i, type HTTPServerAttrs as j, type ProcessAttrs as k, type ServerAddressAttrs as l, type ServiceAttrs as m, type ThreadAttrs as n, type URLAttrs as o, attrs as p, autoRedactPII as q, checkDeprecatedAttribute as r, dbClient as s, defaultGuardrails as t, httpClient as u, httpServer as v, identify as w, mergeAttrs as x, mergeServiceResource as y, request as z };
