import { AutomationCapabilityReference } from '../Capabilities'; import { AutomationJsonObject, AutomationJsonValue, AutomationSourceApplication } from '../Common'; import { AutomationFlowEdge, AutomationCanvasAnnotation, AutomationFlowNode, AutomationFlowVariable, AutomationFlowViewport } from './Canvas'; export declare enum AutomationFlowKind { CONVERSATIONAL = "conversational", VOICE = "voice", CAMPAIGN = "campaign", MARKETING = "marketing", TICKET = "ticket", SALES = "sales", GENERIC = "generic" } export declare enum AutomationFlowStatus { DRAFT = "draft", ACTIVE = "active", DISABLED = "disabled", ARCHIVED = "archived" } export declare enum AutomationFlowVersionStatus { DRAFT = "draft", TESTING = "testing", PUBLISHED = "published", DEPRECATED = "deprecated" } export declare enum FlowEntryPointExecutionMode { /** Un evento inicia como máximo una ejecución de esta versión del Flow. */ SINGLE = "single", /** El solapamiento fue habilitado explícitamente. */ MULTIPLE = "multiple" } export declare enum AutomationFilterLogicalOperator { /** Todas las condiciones y grupos hijos deben cumplirse. */ ALL = "all", /** Al menos una condición o grupo hijo debe cumplirse. */ ANY = "any" } export declare enum AutomationFilterOperator { EQUALS = "equals", NOT_EQUALS = "notEquals", CONTAINS = "contains", NOT_CONTAINS = "notContains", STARTS_WITH = "startsWith", ENDS_WITH = "endsWith", GREATER_THAN = "greaterThan", GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", LESS_THAN = "lessThan", LESS_THAN_OR_EQUAL = "lessThanOrEqual", IN = "in", NOT_IN = "notIn", EXISTS = "exists", NOT_EXISTS = "notExists" } /** Comparación tipada aplicada a un campo de un evento. */ export interface AutomationFilterCondition { /** JSON Pointer RFC 6901 absoluto dentro del envelope. */ path: string; /** Operación utilizada para comparar el campo. */ operator: AutomationFilterOperator; /** Valor esperado; no aplica a exists/notExists. */ value?: AutomationJsonValue; /** Sensibilidad de comparaciones de strings; por defecto es true. */ caseSensitive?: boolean | null; } /** Grupo recursivo de filtros combinados mediante all o any. */ export interface AutomationFilterGroup { /** Forma en que se combinan condiciones y grupos hijos. */ logicalOperator: AutomationFilterLogicalOperator; /** Comparaciones directas pertenecientes al grupo. */ conditions: AutomationFilterCondition[]; /** Grupos anidados. */ groups: AutomationFilterGroup[]; } /** * Identidad estable del Flow. El contenido ejecutable vive en FlowVersion. */ export interface AutomationFlowDefinition { id: string; spaceId: string; name: string; description?: string | null; kind: AutomationFlowKind; status: AutomationFlowStatus; ownerId?: string | null; tags: string[]; draftVersionId?: string | null; activeVersionId?: string | null; createdAt: string; createdBy: string; updatedAt?: string | null; updatedBy?: string | null; deletedAt?: string | null; } /** * Snapshot del canvas. * * El canvas pertenece a Automations y no depende de contratos de otras * aplicaciones. */ export interface AutomationFlowCanvas { variables: AutomationFlowVariable[]; nodes: AutomationFlowNode[]; edges: AutomationFlowEdge[]; /** Anotaciones visuales que no forman parte del grafo ejecutable. */ annotations?: AutomationCanvasAnnotation[]; viewport: AutomationFlowViewport; } /** * Snapshot versionado e inmutable una vez publicado. */ export interface AutomationFlowVersion { id: string; flowId: string; version: number; schemaVersion: number; revision: number; status: AutomationFlowVersionStatus; canvas: AutomationFlowCanvas; entryPoints: FlowEntryPoint[]; createdAt: string; createdBy: string; updatedAt?: string | null; updatedBy?: string | null; publishedAt?: string | null; publishedBy?: string | null; } /** * Evento de entrada que puede iniciar una versión concreta de un Flow. * * La configuración autoritativa vive en esta entidad. El nodo trigger es su * representación en el canvas y se vincula mediante triggerNodeId. */ export interface FlowEntryPoint { id: string; flowId: string; flowVersionId: string; name: string; sourceApplication: AutomationSourceApplication; eventType: string; triggerCapability?: AutomationCapabilityReference | null; /** Grupo vacío acepta cualquier evento del tipo configurado. */ filters: AutomationFilterGroup; enabled: boolean; triggerNodeId: string; priority: number; executionMode: FlowEntryPointExecutionMode; metadata?: AutomationJsonObject | null; }