import type { ENTITY_RELATION_TYPES } from '@redocly/config';
import type { Node } from '@markdoc/markdoc';
import type { ResolvedNavItem, REDOCLY_TEAMS_RBAC } from '@redocly/config';
import type { JSONSchema7 } from 'json-schema';
import type { ApiItemData } from './apiItem.js';
export type Referenced<T> = T | {
    $ref: string;
};
export interface AsyncApiDefinition {
    asyncapi: string;
    id?: string;
    info: AsyncApiInfo;
    servers?: Record<string, AsyncApiServer>;
    defaultContentType?: string;
    channels?: AsyncApiChannels;
    operations?: AsyncApiOperations;
    components?: AsyncApiComponents;
    'x-tagGroups'?: {
        name: string;
        tags: string[];
        [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
    }[];
    'x-redocly-catalog-key'?: string;
}
export interface AsyncApiDefinitionReferenced {
    asyncapi: string;
    id?: string;
    info: AsyncApiInfo;
    servers?: Record<string, AsyncApiServer>;
    defaultContentType?: string;
    channels?: AsyncApiChannels;
    operations?: AsyncApiOperationsReferenced;
    components?: AsyncApiComponentsReferenced;
    'x-tagGroups'?: {
        name: string;
        tags: string[];
        [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
    }[];
}
export interface AsyncApiInfo {
    title: string;
    version: string;
    description?: string;
    termsOfService?: string;
    contact?: AsyncApiContact;
    license?: AsyncApiLicense;
    tags?: AsyncApiTag[];
    externalDocs?: AsyncApiExternalDocs;
    'x-metadata'?: Record<string, unknown>;
}
export interface AsyncApiContact {
    name?: string;
    url?: string;
    email?: string;
}
export interface AsyncApiLicense {
    name: string;
    url?: string;
}
export interface AsyncApiTag {
    name: string;
    description?: string;
    externalDocs?: AsyncApiExternalDocs;
}
export interface AsyncApiExternalDocs {
    description?: string;
    url: string;
}
export interface AsyncApiServer {
    host: string;
    protocol: string;
    protocolVersion?: string;
    pathname?: string;
    description?: string;
    title?: string;
    summary?: string;
    variables?: AsyncApiServerVariables;
    tags?: AsyncApiTag[];
    externalDocs?: AsyncApiExternalDocs;
    bindings?: AsyncApiServerBinding;
}
export interface AsyncApiServerVariables {
    [name: string]: AsyncApiServerVariable;
}
export interface AsyncApiChannels {
    [name: string]: AsyncApiChannel;
}
export interface AsyncApiServerVariable {
    enum?: string[];
    default: string;
    description?: string;
}
export interface AsyncApiServerBinding {
    kafka?: AsyncApiServerKafkaBinding;
}
export interface AsyncApiServerKafkaBinding {
    schemaRegistryUrl?: string;
    schemaRegistryVendor?: string;
    bindingVersion?: string;
}
export interface AsyncApiChannel {
    address?: string;
    messages?: AsyncApiMessages;
    title?: string;
    summary?: string;
    description?: string;
    servers?: AsyncApiServer[];
    parameters?: AsyncApiParameters;
    tags?: AsyncApiTag[];
    externalDocs?: AsyncApiExternalDocs;
    bindings?: AsyncApiChannelBinding;
    'x-badges'?: AsyncApiXBadges[];
    [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
}
export interface AsyncApiXBadges {
    name: string;
    position?: 'before' | 'after';
    color?: string;
}
export interface AsyncApiChannelBinding {
    kafka?: AsyncApiChannelKafkaBinding;
    amqp?: AsyncApiChannelAMQPBinding;
}
export interface AsyncApiChannelKafkaBinding {
    topic?: string;
    partitions?: number;
    replicas?: number;
    bindingVersion?: string;
    topicConfiguration?: {
        'cleanup.policy'?: string[];
        'retention.ms'?: number;
        'retention.bytes'?: number;
        'delete.retention.ms'?: number;
        'max.message.bytes'?: number;
        'confluent.key.schema.validation'?: boolean;
        'confluent.key.subject.name.strategy'?: string;
        'confluent.value.schema.validation'?: boolean;
        'confluent.value.subject.name.strategy'?: string;
    };
}
export interface AsyncApiChannelAMQPBinding {
    is: 'routingKey' | 'queue';
}
export interface AsyncApiMessages {
    [name: string]: AsyncApiMessage;
}
export interface AsyncApiParameters {
    [name: string]: AsyncApiParameter;
}
export interface AsyncApiParameter {
    enum?: string[];
    default?: string;
    description?: string;
    examples?: string[];
    location?: string;
}
export interface AsyncApiMessage {
    headers?: AsyncAPISchema;
    payload?: AsyncAPISchema;
    correlationId?: AsyncApiCorrelationId;
    contentType?: string;
    name?: string;
    title?: string;
    summary?: string;
    description?: string;
    tags?: AsyncApiTag[];
    externalDocs?: AsyncApiExternalDocs;
    bindings?: AsyncApiMessageBinding;
    examples?: AsyncApiMessageExample[];
}
export interface AsyncApiMessageReferenced {
    headers?: AsyncAPISchema;
    payload?: Referenced<AsyncAPISchema>;
    correlationId?: AsyncApiCorrelationId;
    contentType?: string;
    name?: string;
    title?: string;
    summary?: string;
    description?: string;
    tags?: AsyncApiTag[];
    externalDocs?: AsyncApiExternalDocs;
    bindings?: AsyncApiMessageBinding;
    examples?: AsyncApiMessageExample[];
}
export interface AsyncApiCorrelationId {
    description?: string;
    location: string;
}
export interface AsyncApiMessageBinding {
    kafka?: AsyncApiMessageKafkaBinding;
}
export interface AsyncApiMessageKafkaBinding {
    key?: JSONSchema7;
    schemaIdLocation?: string;
    schemaIdPayloadEncoding?: string;
    schemaLookupStrategy?: string;
    bindingVersion?: string;
}
export interface AsyncApiMessageExample {
    payload?: Record<string, any>;
    name?: string;
    summary?: string;
}
export interface MultiFormatSchemaObject {
    schema: JSONSchema7 | AvroSchema;
    schemaFormat: string;
}
export interface AsyncApiOperations {
    [name: string]: AsyncApiOperation;
}
export interface AsyncApiOperationsReferenced {
    [name: string]: AsyncApiOperationReferenced;
}
export interface AsyncApiOperation {
    action: 'send' | 'receive';
    channel: AsyncApiChannel;
    title?: string;
    summary?: string;
    description?: string;
    tags?: AsyncApiTag[];
    externalDocs?: AsyncApiExternalDocs;
    bindings?: AsyncApiOperationBinding;
    traits?: AsyncApiOperationTraits[];
    messages?: AsyncApiMessage[];
    reply?: AsyncApiOperationReply;
    'x-badges'?: AsyncApiXBadges[];
    'x-catalogRelations'?: {
        type: (typeof ENTITY_RELATION_TYPES)[number];
        key: string;
    }[];
    [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
}
export interface AsyncApiOperationReferenced {
    action: 'send' | 'receive';
    channel: AsyncApiChannel;
    title?: string;
    summary?: string;
    description?: string;
    tags?: AsyncApiTag[];
    externalDocs?: AsyncApiExternalDocs;
    bindings?: AsyncApiOperationBinding;
    traits?: AsyncApiOperationTraits[];
    messages?: Referenced<AsyncApiMessage>[];
    reply?: AsyncApiOperationReply;
    'x-badges'?: AsyncApiXBadges[];
    'x-catalogRelations'?: {
        type: (typeof ENTITY_RELATION_TYPES)[number];
        key: string;
    }[];
    [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
}
export interface AsyncApiOperationReply {
    address?: {
        description?: string;
        location: string;
    };
    channel?: AsyncApiChannel;
    messages?: AsyncApiMessage[];
}
export interface AsyncApiOperationTraits {
    title?: string;
    summary?: string;
    description?: string;
    tags?: AsyncApiTag[];
    externalDocs?: AsyncApiExternalDocs;
    bindings?: AsyncApiOperationBinding;
}
export interface AsyncApiOperationBinding {
    kafka?: AsyncApiOperationKafkaBinding;
}
export interface AsyncApiOperationKafkaBinding {
    groupId?: {
        type: string;
        enum: string[];
    };
    clientId?: {
        type: string;
        enum: string[];
    };
    bindingVersion?: string;
}
export interface AsyncApiComponents {
    messages: Record<string, AsyncApiMessage>;
    schemas: Record<string, AsyncAPISchema>;
    tags: Record<string, AsyncApiTag>;
}
export interface AsyncApiComponentsReferenced {
    messages: Record<string, AsyncApiMessageReferenced>;
    schemas: Record<string, AsyncAPISchema>;
    tags: Record<string, AsyncApiTag>;
}
export interface AvroSchema {
    type: string | string[] | AvroSchema[];
    name?: string;
    doc?: string;
    symbols?: string[];
    fields?: Array<{
        name: string;
        type: AvroSchema | string | (string | AvroSchema)[];
        doc?: string;
        default?: any;
    }>;
    items?: AvroSchema | string;
    values?: AvroSchema | string;
}
export type ResolvedAsyncApiNavItem = ResolvedNavItem & {
    apiItemData?: ApiItemData;
    items?: ResolvedAsyncApiNavItem[];
    action?: string;
    ast?: Node | Node[];
    httpVerb?: string;
};
export type DownloadUrls = {
    url: string;
};
export type ChannelWithKey = AsyncApiChannel & {
    key: string;
};
export type AsyncAPISchema = JSONSchema7 | MultiFormatSchemaObject;
