import { AutomationCustomer, AutomationJsonObject, AutomationJsonSchema, AutomationResourceReference, AutomationSourceApplication } from '../Common'; export declare const AUTOMATION_MESSAGE_SCHEMAS: { readonly DOMAIN_EVENT_V1: "automations.domain-event/v1"; readonly START_REQUEST_V1: "automations.start-request/v1"; readonly EXECUTION_WORK_ITEM_V1: "automations.execution.work-item/v1"; }; export interface AutomationEventDefinition { eventType: string; version: number; sourceApplication: AutomationSourceApplication; name: string; description?: string | null; payloadSchema: AutomationJsonSchema; /** Schema de la vista del envelope cuyos paths pueden utilizarse en filtros. */ filterSchema?: AutomationJsonSchema | null; requiredPermissions: string[]; enabled: boolean; } export interface AutomationEventEnvelope { schema: typeof AUTOMATION_MESSAGE_SCHEMAS.DOMAIN_EVENT_V1; id: string; spaceId: string; sourceApplication: AutomationSourceApplication; eventType: string; eventVersion: number; /** Clave estable usada como SessionId; no incluye spaceId. */ orderingKey: string; /** Secuencia monotónica opcional asignada por el propietario del agregado. */ aggregateSequence?: number | null; occurredAt: string; /** Instante de ingreso al primer consumidor controlado. */ receivedAt?: string | null; customer?: AutomationCustomer | null; /** Entidad principal sobre la que ocurrió el evento. */ subject?: AutomationResourceReference | null; correlationId?: string | null; causationId?: string | null; idempotencyKey?: string | null; payload: AutomationJsonObject; metadata?: AutomationJsonObject | null; } /** Solicitud asíncrona generada después de resolver un Entry Point. */ export interface AutomationStartRequestMessage { schema: typeof AUTOMATION_MESSAGE_SCHEMAS.START_REQUEST_V1; requestId: string; spaceId: string; flowId: string; flowVersionId: string; entryPointId: string; trigger: AutomationEventEnvelope; requestedAt: string; correlationId?: string | null; causationId?: string | null; /** Debe permanecer estable en todos los reintentos de la misma operación. */ idempotencyKey: string; metadata?: AutomationJsonObject | null; } export declare enum AutomationEntryPointExclusionCode { ENTRY_POINT_DISABLED = "entryPointDisabled", SOURCE_APPLICATION_MISMATCH = "sourceApplicationMismatch", EVENT_TYPE_MISMATCH = "eventTypeMismatch", FILTERS_NOT_MATCHED = "filtersNotMatched", FLOW_NOT_ACTIVE = "flowNotActive", VERSION_NOT_PUBLISHED = "versionNotPublished", LOWER_PRIORITY = "lowerPriority", EXECUTION_MODE_RESTRICTED = "executionModeRestricted" } /** Motivo estructurado por el que un Entry Point no fue seleccionado. */ export interface AutomationEntryPointExclusion { /** Código estable para lógica, métricas y observabilidad. */ code: AutomationEntryPointExclusionCode; /** Explicación humana opcional; no debe utilizarse para lógica. */ message?: string | null; /** Datos diagnósticos específicos del código. */ details?: AutomationJsonObject | null; } export interface ResolveFlowEntryPointsRequest { event: AutomationEventEnvelope; } export interface ResolvedFlowEntryPoint { /** Definición estable del Flow. */ flowId: string; /** Versión publicada candidata a recibir el evento. */ flowVersionId: string; /** Entry Point evaluado. */ entryPointId: string; /** Prioridad utilizada para resolver candidatos. */ priority: number; /** Indica si el candidato debe iniciar una ejecución. */ selected: boolean; /** Motivo de exclusión; ausente cuando selected es true. */ exclusion?: AutomationEntryPointExclusion | null; } export interface ResolveFlowEntryPointsResult { matches: ResolvedFlowEntryPoint[]; }