{"openapi":"3.0.0","info":{"title":"360studio App API","version":"1.0.0","description":"API para usuarios de negocios autenticados con Firebase Auth. Todas las capacidades operativas respetan el contexto Business y Workspace."},"servers":[{"url":"https://api.360studio.app/app/v1","description":"Produccion"},{"url":"https://sandbox.api.360studio.app/app/v1","description":"Sandbox"}],"tags":[{"name":"Authorization","description":"Sesion efectiva, roles y permisos evaluados en servidor."},{"name":"Roles","description":"Roles de sistema y personalizados por negocio o Workspace."},{"name":"Businesses","description":"Gestion del negocio autenticado."},{"name":"Workspaces","description":"Gestion de workspaces autorizados del negocio."},{"name":"Business Config","description":"Configuracion de negocio para app."},{"name":"Persons","description":"Directorio transversal de personas del negocio."},{"name":"Organizations","description":"Directorio transversal de organizaciones del negocio."},{"name":"Directory Relationships","description":"Relaciones entre personas, organizaciones y productos."},{"name":"Contact Tags","description":"Clasificacion Business-global de contactos."},{"name":"PaymentCoupons","description":"Gestion de cupones del negocio."},{"name":"Receivables","description":"Cuentas por cobrar y recordatorios por Workspace."},{"name":"Settlements","description":"Consulta y descargas de settlements."},{"name":"Dashboard","description":"Metrica y salud para dashboard de app."},{"name":"API Keys","description":"Gestion de API keys del negocio."},{"name":"Users","description":"Usuarios, membresias y asignaciones de roles del negocio."},{"name":"Teams","description":"Equipos de atención, miembros, horarios y distribución por Workspace."},{"name":"Tickets","description":"Tickets operativos, configuración, asignación y trazabilidad por Workspace."},{"name":"Webhooks","description":"Hooks y entregas para eventos de pago."},{"name":"Assistant","description":"Diseño y publicación versionada de flujos de diálogo."},{"name":"Studio AI","description":"Runtime y sesiones interactivas autorizadas de 360studio AI."},{"name":"Automations","description":"Definiciones Evento → Condiciones → Acciones por Workspace."},{"name":"Integrations","description":"Conexiones Business-globales y operaciones externas versionadas por Workspace."},{"name":"Forms","description":"Formularios y links públicos de captura por Workspace."},{"name":"Calendar","description":"Disponibilidad, citas, bloqueos y links públicos por Workspace."},{"name":"Products","description":"Productos y categorías globales del negocio."},{"name":"Templates","description":"Plantillas reutilizables y seguras por Workspace."},{"name":"Notifications","description":"Notificaciones in-app, dispositivos y entregas FCM."},{"name":"Broadcasts","description":"Difusiones WhatsApp, destinatarios y métricas por Workspace."}],"components":{"securitySchemes":{"FirebaseBearer":{"type":"http","scheme":"bearer","bearerFormat":"Firebase ID Token"}},"parameters":{"IdPathParam":{"in":"path","name":"id","required":true,"schema":{"type":"string"}},"ObjectIdPathParam":{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"WorkspaceIdPathParam":{"in":"path","name":"workspaceId","required":true,"schema":{"type":"string"}},"WorkspaceToolIdPathParam":{"in":"path","name":"toolId","required":true,"schema":{"type":"string"}},"WorkspaceIdHeader":{"in":"header","name":"x-workspace-id","required":true,"schema":{"type":"string"},"description":"Workspace autorizado para la operación App API."},"OptionalWorkspaceIdHeader":{"in":"header","name":"x-workspace-id","required":false,"schema":{"type":"string"},"description":"Workspace autorizado. Sin este header, solo se expone actividad de alcance Business."},"HookIdPathParam":{"in":"path","name":"hookId","required":true,"schema":{"type":"string"}},"DeliveryIdPathParam":{"in":"path","name":"deliveryId","required":true,"schema":{"type":"string"}},"KeyIdPathParam":{"in":"path","name":"keyId","required":true,"schema":{"type":"string"}},"RoleIdPathParam":{"in":"path","name":"roleId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"MembershipIdPathParam":{"in":"path","name":"membershipId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"TeamIdPathParam":{"in":"path","name":"teamId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}},"schemas":{"IntegrationArtifactSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"invocation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"operation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"operation_version_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"filename":{"type":"string"},"content_type":{"type":"string"},"size_bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"sha256":{"type":"string"},"status":{"type":"string","enum":["active","deleted"]},"expires_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","invocation_id","operation_id","operation_version_id","output_key","filename","content_type","size_bytes","sha256","status","expires_at","created_by"]}},"required":["success","data"]},"IntegrationConnectionCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"base_url":{"type":"string","maxLength":2048,"format":"uri"},"egress_mode":{"type":"string","enum":["standard","static_ip"]},"auth":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["api_key_header"]},"header_name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"secret":{"type":"string","minLength":1,"maxLength":4096}},"required":["type","header_name","secret"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["basic"]},"username":{"type":"string","minLength":1,"maxLength":4096},"password":{"type":"string","minLength":1,"maxLength":4096}},"required":["type","username","password"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["bearer"]},"secret":{"type":"string","minLength":1,"maxLength":4096}},"required":["type","secret"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["jwt_bearer"]},"secret":{"type":"string","minLength":1,"maxLength":16384}},"required":["type","secret"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["dynamic_bearer"]},"token_url":{"type":"string","maxLength":2048,"format":"uri"},"token_method":{"type":"string","enum":["GET","POST"]},"client_id":{"type":"string","minLength":1,"maxLength":4096},"client_secret":{"type":"string","maxLength":4096},"token_json_path":{"type":"string","maxLength":512,"pattern":"^\\$(?:\\.[A-Za-z_][A-Za-z0-9_-]*|\\[\\d+\\]|\\[\"[^\"\\\\]+\"\\]|\\['[^'\\\\]+'\\])*$"},"expires_in_json_path":{"type":"string","maxLength":512,"pattern":"^\\$(?:\\.[A-Za-z_][A-Za-z0-9_-]*|\\[\\d+\\]|\\[\"[^\"\\\\]+\"\\]|\\['[^'\\\\]+'\\])*$"},"default_ttl_seconds":{"default":300,"type":"integer","minimum":60,"maximum":86400},"token_timeout_ms":{"default":10000,"type":"integer","minimum":1000,"maximum":30000},"token_cache_mode":{"default":"ttl","type":"string","enum":["ttl","per_request"]},"scope":{"type":"string","minLength":1,"maxLength":2000},"audience":{"type":"string","minLength":1,"maxLength":2000},"token_headers":{"default":[],"maxItems":20,"type":"array","items":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"value_source":{"type":"string","enum":["static"]},"value":{"type":"string","minLength":1,"maxLength":4096}},"required":["name","value_source","value"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"value_source":{"type":"string","enum":["uuid","client_id"]}},"required":["name","value_source"],"additionalProperties":false}]}},"additional_headers":{"default":[],"maxItems":20,"type":"array","items":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"value_source":{"type":"string","enum":["static"]},"value":{"type":"string","minLength":1,"maxLength":4096}},"required":["name","value_source","value"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"value_source":{"type":"string","enum":["uuid","client_id"]}},"required":["name","value_source"],"additionalProperties":false}]}}},"required":["type","token_url","token_method","client_id","client_secret","token_json_path"],"additionalProperties":false}]}},"required":["name","base_url","auth"],"additionalProperties":false},"IntegrationConnectionUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"base_url":{"type":"string","maxLength":2048,"format":"uri"},"egress_mode":{"type":"string","enum":["standard","static_ip"]},"status":{"type":"string","enum":["active","inactive"]},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["expected_version"],"additionalProperties":false},"IntegrationCredentialRotateInput":{"type":"object","properties":{"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"auth":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["api_key_header"]},"header_name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"secret":{"type":"string","minLength":1,"maxLength":4096}},"required":["type","header_name","secret"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["basic"]},"username":{"type":"string","minLength":1,"maxLength":4096},"password":{"type":"string","minLength":1,"maxLength":4096}},"required":["type","username","password"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["bearer"]},"secret":{"type":"string","minLength":1,"maxLength":4096}},"required":["type","secret"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["jwt_bearer"]},"secret":{"type":"string","minLength":1,"maxLength":16384}},"required":["type","secret"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["dynamic_bearer"]},"token_url":{"type":"string","maxLength":2048,"format":"uri"},"token_method":{"type":"string","enum":["GET","POST"]},"client_id":{"type":"string","minLength":1,"maxLength":4096},"client_secret":{"type":"string","maxLength":4096},"token_json_path":{"type":"string","maxLength":512,"pattern":"^\\$(?:\\.[A-Za-z_][A-Za-z0-9_-]*|\\[\\d+\\]|\\[\"[^\"\\\\]+\"\\]|\\['[^'\\\\]+'\\])*$"},"expires_in_json_path":{"type":"string","maxLength":512,"pattern":"^\\$(?:\\.[A-Za-z_][A-Za-z0-9_-]*|\\[\\d+\\]|\\[\"[^\"\\\\]+\"\\]|\\['[^'\\\\]+'\\])*$"},"default_ttl_seconds":{"default":300,"type":"integer","minimum":60,"maximum":86400},"token_timeout_ms":{"default":10000,"type":"integer","minimum":1000,"maximum":30000},"token_cache_mode":{"default":"ttl","type":"string","enum":["ttl","per_request"]},"scope":{"type":"string","minLength":1,"maxLength":2000},"audience":{"type":"string","minLength":1,"maxLength":2000},"token_headers":{"default":[],"maxItems":20,"type":"array","items":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"value_source":{"type":"string","enum":["static"]},"value":{"type":"string","minLength":1,"maxLength":4096}},"required":["name","value_source","value"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"value_source":{"type":"string","enum":["uuid","client_id"]}},"required":["name","value_source"],"additionalProperties":false}]}},"additional_headers":{"default":[],"maxItems":20,"type":"array","items":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"value_source":{"type":"string","enum":["static"]},"value":{"type":"string","minLength":1,"maxLength":4096}},"required":["name","value_source","value"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"},"value_source":{"type":"string","enum":["uuid","client_id"]}},"required":["name","value_source"],"additionalProperties":false}]}}},"required":["type","token_url","token_method","client_id","client_secret","token_json_path"],"additionalProperties":false}]}},"required":["expected_version","auth"],"additionalProperties":false},"IntegrationConnectionSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"name":{"type":"string"},"base_url":{"type":"string","format":"uri"},"egress_mode":{"type":"string","enum":["standard","static_ip"]},"auth":{"type":"object","properties":{"type":{"type":"string","enum":["none","api_key_header","basic","bearer","jwt_bearer","dynamic_bearer"]},"header_name":{"type":"string"},"username_preview":{"type":"string"},"configured":{"type":"boolean"},"secret_preview":{"type":"string"},"token_url":{"type":"string","format":"uri"},"token_method":{"type":"string","enum":["GET","POST"]},"client_id_preview":{"type":"string"},"token_json_path":{"type":"string"},"expires_in_json_path":{"type":"string"},"default_ttl_seconds":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"token_timeout_ms":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"token_cache_mode":{"type":"string","enum":["ttl","per_request"]},"scope":{"type":"string"},"audience":{"type":"string"},"token_headers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value_source":{"type":"string","enum":["static","uuid","client_id"]},"configured":{"type":"boolean"},"value_preview":{"type":"string"}},"required":["name","value_source","configured"]}},"additional_headers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value_source":{"type":"string","enum":["static","uuid","client_id"]},"configured":{"type":"boolean"},"value_preview":{"type":"string"}},"required":["name","value_source","configured"]}},"credential_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"credential_updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["type","configured","credential_version"]},"status":{"type":"string","enum":["active","inactive"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"updated_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","name","base_url","egress_mode","auth","status","version","created_by","updated_by"]}},"required":["success","data"]},"IntegrationConnectionListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"name":{"type":"string"},"base_url":{"type":"string","format":"uri"},"egress_mode":{"type":"string","enum":["standard","static_ip"]},"auth":{"type":"object","properties":{"type":{"type":"string","enum":["none","api_key_header","basic","bearer","jwt_bearer","dynamic_bearer"]},"header_name":{"type":"string"},"username_preview":{"type":"string"},"configured":{"type":"boolean"},"secret_preview":{"type":"string"},"token_url":{"type":"string","format":"uri"},"token_method":{"type":"string","enum":["GET","POST"]},"client_id_preview":{"type":"string"},"token_json_path":{"type":"string"},"expires_in_json_path":{"type":"string"},"default_ttl_seconds":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"token_timeout_ms":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"token_cache_mode":{"type":"string","enum":["ttl","per_request"]},"scope":{"type":"string"},"audience":{"type":"string"},"token_headers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value_source":{"type":"string","enum":["static","uuid","client_id"]},"configured":{"type":"boolean"},"value_preview":{"type":"string"}},"required":["name","value_source","configured"]}},"additional_headers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value_source":{"type":"string","enum":["static","uuid","client_id"]},"configured":{"type":"boolean"},"value_preview":{"type":"string"}},"required":["name","value_source","configured"]}},"credential_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"credential_updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["type","configured","credential_version"]},"status":{"type":"string","enum":["active","inactive"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"updated_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","name","base_url","egress_mode","auth","status","version","created_by","updated_by"]}}},"required":["success","data"]},"IntegrationBindingCreateInput":{"type":"object","properties":{"connection_id":{"type":"string","pattern":"^[a-f\\d]{24}$"}},"required":["connection_id"],"additionalProperties":false},"IntegrationBindingUpdateInput":{"type":"object","properties":{"status":{"type":"string","enum":["active","inactive"]},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["status","expected_version"],"additionalProperties":false},"IntegrationBindingSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"connection_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"status":{"type":"string","enum":["active","inactive"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"updated_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","connection_id","status","version","created_by","updated_by"]}},"required":["success","data"]},"IntegrationBindingListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"connection_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"status":{"type":"string","enum":["active","inactive"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"updated_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","connection_id","status","version","created_by","updated_by"]}}},"required":["success","data"]},"IntegrationOperationInput":{"type":"object","properties":{"binding_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"draft":{"type":"object","properties":{"inputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"}},"required":["key","data_type","required"],"additionalProperties":false}},"request":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"input_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header","body"]},"name":{"type":"string","minLength":1,"maxLength":120},"path":{"type":"string","minLength":2,"maxLength":512}},"required":["input_key","target"],"additionalProperties":false}},"body_content_type":{"type":"string","enum":["application/json"]},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["method","path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"outputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"},"source":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["json_path"]},"path":{"type":"string","maxLength":512,"pattern":"^\\$([.[])"}},"required":["kind","path"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["header"]},"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["kind","name"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["status_code"]}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["response_body"]},"allowed_content_types":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"filename":{"type":"string","minLength":1,"maxLength":255},"retention_days":{"type":"integer","minimum":1,"maximum":365}},"required":["kind","allowed_content_types","retention_days"],"additionalProperties":false}]}},"required":["key","data_type","required","source"],"additionalProperties":false}},"outcomes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"status_codes":{"maxItems":500,"type":"array","items":{"type":"integer","minimum":100,"maximum":599}},"conditions":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"operator":{"type":"string","enum":["equals","not_equals","exists","not_exists"]},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"string","nullable":true,"enum":[null]}]}},"required":["output_key","operator"],"additionalProperties":false}}},"required":["key","label","status_codes","conditions"],"additionalProperties":false}},"retry_policy":{"type":"object","properties":{"mode":{"type":"string","enum":["never","safe","provider_idempotency"]},"max_attempts":{"type":"integer","minimum":1,"maximum":5},"idempotency_header":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["mode","max_attempts"],"additionalProperties":false},"polling":{"type":"object","properties":{"pending_outcomes":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"}},"request":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header"]},"name":{"type":"string","minLength":1,"maxLength":120}},"required":["output_key","target","name"],"additionalProperties":false}},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"interval_seconds":{"type":"integer","minimum":1,"maximum":3600},"max_polls":{"type":"integer","minimum":1,"maximum":100}},"required":["pending_outcomes","request","interval_seconds","max_polls"],"additionalProperties":false}},"required":["inputs","request","outputs","outcomes","retry_policy"],"additionalProperties":false}},"required":["binding_id","name","draft"],"additionalProperties":false},"IntegrationOperationDraftReplaceInput":{"type":"object","properties":{"binding_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"draft":{"type":"object","properties":{"inputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"}},"required":["key","data_type","required"],"additionalProperties":false}},"request":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"input_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header","body"]},"name":{"type":"string","minLength":1,"maxLength":120},"path":{"type":"string","minLength":2,"maxLength":512}},"required":["input_key","target"],"additionalProperties":false}},"body_content_type":{"type":"string","enum":["application/json"]},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["method","path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"outputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"},"source":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["json_path"]},"path":{"type":"string","maxLength":512,"pattern":"^\\$([.[])"}},"required":["kind","path"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["header"]},"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["kind","name"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["status_code"]}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["response_body"]},"allowed_content_types":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"filename":{"type":"string","minLength":1,"maxLength":255},"retention_days":{"type":"integer","minimum":1,"maximum":365}},"required":["kind","allowed_content_types","retention_days"],"additionalProperties":false}]}},"required":["key","data_type","required","source"],"additionalProperties":false}},"outcomes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"status_codes":{"maxItems":500,"type":"array","items":{"type":"integer","minimum":100,"maximum":599}},"conditions":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"operator":{"type":"string","enum":["equals","not_equals","exists","not_exists"]},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"string","nullable":true,"enum":[null]}]}},"required":["output_key","operator"],"additionalProperties":false}}},"required":["key","label","status_codes","conditions"],"additionalProperties":false}},"retry_policy":{"type":"object","properties":{"mode":{"type":"string","enum":["never","safe","provider_idempotency"]},"max_attempts":{"type":"integer","minimum":1,"maximum":5},"idempotency_header":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["mode","max_attempts"],"additionalProperties":false},"polling":{"type":"object","properties":{"pending_outcomes":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"}},"request":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header"]},"name":{"type":"string","minLength":1,"maxLength":120}},"required":["output_key","target","name"],"additionalProperties":false}},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"interval_seconds":{"type":"integer","minimum":1,"maximum":3600},"max_polls":{"type":"integer","minimum":1,"maximum":100}},"required":["pending_outcomes","request","interval_seconds","max_polls"],"additionalProperties":false}},"required":["inputs","request","outputs","outcomes","retry_policy"],"additionalProperties":false},"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["binding_id","name","draft","expected_revision"],"additionalProperties":false},"IntegrationOperationPublishInput":{"type":"object","properties":{"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["expected_revision"],"additionalProperties":false},"IntegrationOperationTestInput":{"type":"object","properties":{"binding_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"inputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"}},"required":["key","data_type","required"],"additionalProperties":false}},"request":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"input_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header","body"]},"name":{"type":"string","minLength":1,"maxLength":120},"path":{"type":"string","minLength":2,"maxLength":512}},"required":["input_key","target"],"additionalProperties":false}},"body_content_type":{"type":"string","enum":["application/json"]},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["method","path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"retry_policy":{"type":"object","properties":{"mode":{"type":"string","enum":["never","safe","provider_idempotency"]},"max_attempts":{"type":"integer","minimum":1,"maximum":5},"idempotency_header":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["mode","max_attempts"],"additionalProperties":false},"values":{"type":"object","additionalProperties":{}},"confirm_side_effects":{"default":false,"type":"boolean"}},"required":["binding_id","inputs","request","retry_policy","values"],"additionalProperties":false},"IntegrationOperationTestSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"status_code":{"type":"integer","minimum":100,"maximum":599},"headers":{"type":"object","additionalProperties":{"type":"string"}},"content_type":{"type":"string"},"body_kind":{"type":"string","enum":["json","text","empty","binary","invalid_json"]},"body":{},"body_text":{"type":"string"},"duration_ms":{"type":"integer","minimum":0,"maximum":9007199254740991},"body_truncated":{"type":"boolean"},"body_size_bytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["status_code","headers","body_kind","duration_ms","body_truncated","body_size_bytes"]}},"required":["success","data"]},"IntegrationOperationTestFailure":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string"},"code":{"type":"string","enum":["authorization_revoked","token_request_failed","invalid_token_response","destination_blocked","dns_failed","network_error","timeout","redirect_not_allowed","response_too_large","invalid_content_type","invalid_json","response_contract_mismatch","unmapped_response","ambiguous_outcome","rate_limited","internal_error"]},"retryable":{"type":"boolean"},"duration_ms":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["success","error","code","retryable","duration_ms"]},"IntegrationOperationSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"binding_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"connection_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"name":{"type":"string"},"description":{"type":"string"},"draft":{"type":"object","properties":{"inputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"}},"required":["key","data_type","required"],"additionalProperties":false}},"request":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"input_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header","body"]},"name":{"type":"string","minLength":1,"maxLength":120},"path":{"type":"string","minLength":2,"maxLength":512}},"required":["input_key","target"],"additionalProperties":false}},"body_content_type":{"type":"string","enum":["application/json"]},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["method","path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"outputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"},"source":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["json_path"]},"path":{"type":"string","maxLength":512,"pattern":"^\\$([.[])"}},"required":["kind","path"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["header"]},"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["kind","name"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["status_code"]}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["response_body"]},"allowed_content_types":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"filename":{"type":"string","minLength":1,"maxLength":255},"retention_days":{"type":"integer","minimum":1,"maximum":365}},"required":["kind","allowed_content_types","retention_days"],"additionalProperties":false}]}},"required":["key","data_type","required","source"],"additionalProperties":false}},"outcomes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"status_codes":{"maxItems":500,"type":"array","items":{"type":"integer","minimum":100,"maximum":599}},"conditions":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"operator":{"type":"string","enum":["equals","not_equals","exists","not_exists"]},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"string","nullable":true,"enum":[null]}]}},"required":["output_key","operator"],"additionalProperties":false}}},"required":["key","label","status_codes","conditions"],"additionalProperties":false}},"retry_policy":{"type":"object","properties":{"mode":{"type":"string","enum":["never","safe","provider_idempotency"]},"max_attempts":{"type":"integer","minimum":1,"maximum":5},"idempotency_header":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["mode","max_attempts"],"additionalProperties":false},"polling":{"type":"object","properties":{"pending_outcomes":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"}},"request":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header"]},"name":{"type":"string","minLength":1,"maxLength":120}},"required":["output_key","target","name"],"additionalProperties":false}},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"interval_seconds":{"type":"integer","minimum":1,"maximum":3600},"max_polls":{"type":"integer","minimum":1,"maximum":100}},"required":["pending_outcomes","request","interval_seconds","max_polls"],"additionalProperties":false}},"required":["inputs","request","outputs","outcomes","retry_policy"],"additionalProperties":false},"draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"updated_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","binding_id","connection_id","name","draft","draft_revision","created_by","updated_by"]}},"required":["success","data"]},"IntegrationOperationListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"binding_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"connection_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"name":{"type":"string"},"description":{"type":"string"},"draft":{"type":"object","properties":{"inputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"}},"required":["key","data_type","required"],"additionalProperties":false}},"request":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"input_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header","body"]},"name":{"type":"string","minLength":1,"maxLength":120},"path":{"type":"string","minLength":2,"maxLength":512}},"required":["input_key","target"],"additionalProperties":false}},"body_content_type":{"type":"string","enum":["application/json"]},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["method","path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"outputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"},"source":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["json_path"]},"path":{"type":"string","maxLength":512,"pattern":"^\\$([.[])"}},"required":["kind","path"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["header"]},"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["kind","name"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["status_code"]}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["response_body"]},"allowed_content_types":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"filename":{"type":"string","minLength":1,"maxLength":255},"retention_days":{"type":"integer","minimum":1,"maximum":365}},"required":["kind","allowed_content_types","retention_days"],"additionalProperties":false}]}},"required":["key","data_type","required","source"],"additionalProperties":false}},"outcomes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"status_codes":{"maxItems":500,"type":"array","items":{"type":"integer","minimum":100,"maximum":599}},"conditions":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"operator":{"type":"string","enum":["equals","not_equals","exists","not_exists"]},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"string","nullable":true,"enum":[null]}]}},"required":["output_key","operator"],"additionalProperties":false}}},"required":["key","label","status_codes","conditions"],"additionalProperties":false}},"retry_policy":{"type":"object","properties":{"mode":{"type":"string","enum":["never","safe","provider_idempotency"]},"max_attempts":{"type":"integer","minimum":1,"maximum":5},"idempotency_header":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["mode","max_attempts"],"additionalProperties":false},"polling":{"type":"object","properties":{"pending_outcomes":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"}},"request":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header"]},"name":{"type":"string","minLength":1,"maxLength":120}},"required":["output_key","target","name"],"additionalProperties":false}},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"interval_seconds":{"type":"integer","minimum":1,"maximum":3600},"max_polls":{"type":"integer","minimum":1,"maximum":100}},"required":["pending_outcomes","request","interval_seconds","max_polls"],"additionalProperties":false}},"required":["inputs","request","outputs","outcomes","retry_policy"],"additionalProperties":false},"draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"updated_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","binding_id","connection_id","name","draft","draft_revision","created_by","updated_by"]}}},"required":["success","data"]},"IntegrationOperationVersionSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"operation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"binding_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"connection_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"name":{"type":"string"},"description":{"type":"string"},"draft":{"type":"object","properties":{"inputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"}},"required":["key","data_type","required"],"additionalProperties":false}},"request":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"input_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header","body"]},"name":{"type":"string","minLength":1,"maxLength":120},"path":{"type":"string","minLength":2,"maxLength":512}},"required":["input_key","target"],"additionalProperties":false}},"body_content_type":{"type":"string","enum":["application/json"]},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["method","path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"outputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"},"source":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["json_path"]},"path":{"type":"string","maxLength":512,"pattern":"^\\$([.[])"}},"required":["kind","path"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["header"]},"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["kind","name"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["status_code"]}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["response_body"]},"allowed_content_types":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"filename":{"type":"string","minLength":1,"maxLength":255},"retention_days":{"type":"integer","minimum":1,"maximum":365}},"required":["kind","allowed_content_types","retention_days"],"additionalProperties":false}]}},"required":["key","data_type","required","source"],"additionalProperties":false}},"outcomes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"status_codes":{"maxItems":500,"type":"array","items":{"type":"integer","minimum":100,"maximum":599}},"conditions":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"operator":{"type":"string","enum":["equals","not_equals","exists","not_exists"]},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"string","nullable":true,"enum":[null]}]}},"required":["output_key","operator"],"additionalProperties":false}}},"required":["key","label","status_codes","conditions"],"additionalProperties":false}},"retry_policy":{"type":"object","properties":{"mode":{"type":"string","enum":["never","safe","provider_idempotency"]},"max_attempts":{"type":"integer","minimum":1,"maximum":5},"idempotency_header":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["mode","max_attempts"],"additionalProperties":false},"polling":{"type":"object","properties":{"pending_outcomes":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"}},"request":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header"]},"name":{"type":"string","minLength":1,"maxLength":120}},"required":["output_key","target","name"],"additionalProperties":false}},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"interval_seconds":{"type":"integer","minimum":1,"maximum":3600},"max_polls":{"type":"integer","minimum":1,"maximum":100}},"required":["pending_outcomes","request","interval_seconds","max_polls"],"additionalProperties":false}},"required":["inputs","request","outputs","outcomes","retry_policy"],"additionalProperties":false},"checksum":{"type":"string"},"source_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"published_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","operation_id","binding_id","connection_id","version","name","draft","checksum","source_draft_revision","published_by","published_at"]}},"required":["success","data"]},"IntegrationOperationVersionListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"operation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"binding_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"connection_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"name":{"type":"string"},"description":{"type":"string"},"draft":{"type":"object","properties":{"inputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"}},"required":["key","data_type","required"],"additionalProperties":false}},"request":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"input_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header","body"]},"name":{"type":"string","minLength":1,"maxLength":120},"path":{"type":"string","minLength":2,"maxLength":512}},"required":["input_key","target"],"additionalProperties":false}},"body_content_type":{"type":"string","enum":["application/json"]},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["method","path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"outputs":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]},"required":{"type":"boolean"},"source":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["json_path"]},"path":{"type":"string","maxLength":512,"pattern":"^\\$([.[])"}},"required":["kind","path"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["header"]},"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["kind","name"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["status_code"]}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["response_body"]},"allowed_content_types":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"filename":{"type":"string","minLength":1,"maxLength":255},"retention_days":{"type":"integer","minimum":1,"maximum":365}},"required":["kind","allowed_content_types","retention_days"],"additionalProperties":false}]}},"required":["key","data_type","required","source"],"additionalProperties":false}},"outcomes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"status_codes":{"maxItems":500,"type":"array","items":{"type":"integer","minimum":100,"maximum":599}},"conditions":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"operator":{"type":"string","enum":["equals","not_equals","exists","not_exists"]},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"string","nullable":true,"enum":[null]}]}},"required":["output_key","operator"],"additionalProperties":false}}},"required":["key","label","status_codes","conditions"],"additionalProperties":false}},"retry_policy":{"type":"object","properties":{"mode":{"type":"string","enum":["never","safe","provider_idempotency"]},"max_attempts":{"type":"integer","minimum":1,"maximum":5},"idempotency_header":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"}},"required":["mode","max_attempts"],"additionalProperties":false},"polling":{"type":"object","properties":{"pending_outcomes":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"}},"request":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\/(?!\\/)"},"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"target":{"type":"string","enum":["path","query","header"]},"name":{"type":"string","minLength":1,"maxLength":120}},"required":["output_key","target","name"],"additionalProperties":false}},"timeout_ms":{"type":"integer","minimum":1000,"maximum":30000},"max_response_bytes":{"type":"integer","minimum":1024,"maximum":104857600}},"required":["path","mappings","timeout_ms","max_response_bytes"],"additionalProperties":false},"interval_seconds":{"type":"integer","minimum":1,"maximum":3600},"max_polls":{"type":"integer","minimum":1,"maximum":100}},"required":["pending_outcomes","request","interval_seconds","max_polls"],"additionalProperties":false}},"required":["inputs","request","outputs","outcomes","retry_policy"],"additionalProperties":false},"checksum":{"type":"string"},"source_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"published_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","operation_id","binding_id","connection_id","version","name","draft","checksum","source_draft_revision","published_by","published_at"]}}},"required":["success","data"]},"IntegrationInvocationCreateInput":{"type":"object","properties":{"operation_version_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"idempotency_key":{"type":"string","minLength":1,"maxLength":200},"inputs":{"type":"object","additionalProperties":{}}},"required":["operation_version_id","idempotency_key","inputs"],"additionalProperties":false},"IntegrationInvocationReplayInput":{"type":"object","properties":{"idempotency_key":{"type":"string","minLength":1,"maxLength":200}},"required":["idempotency_key"],"additionalProperties":false},"IntegrationInvocationSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"operation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"operation_version_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"binding_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"connection_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"trigger":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["manual"]}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["dialog_flow"]},"source_id":{"type":"string"}},"required":["kind","source_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["automation"]},"source_id":{"type":"string"}},"required":["kind","source_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["replay"]},"source_id":{"type":"string"}},"required":["kind","source_id"],"additionalProperties":false}]},"replay_of_invocation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"root_invocation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"inputs":{"type":"object","additionalProperties":{}},"outputs":{"type":"object","additionalProperties":{}},"outcome":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"status":{"type":"string","enum":["queued","processing","retrying","waiting_provider","succeeded","failed","timed_out","indeterminate"]},"attempt_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"max_attempts":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"poll_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"next_poll_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"last_http_status":{"type":"integer","minimum":100,"maximum":599},"last_content_type":{"type":"string"},"last_error":{"type":"object","properties":{"code":{"type":"string","enum":["authorization_revoked","token_request_failed","invalid_token_response","destination_blocked","dns_failed","network_error","timeout","redirect_not_allowed","response_too_large","invalid_content_type","invalid_json","response_contract_mismatch","unmapped_response","ambiguous_outcome","rate_limited","internal_error"]},"retryable":{"type":"boolean"},"ambiguous":{"type":"boolean"}},"required":["code","retryable","ambiguous"]},"completed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"duration_ms":{"type":"integer","minimum":0,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","operation_id","operation_version_id","binding_id","connection_id","trigger","root_invocation_id","inputs","status","attempt_count","max_attempts","created_by"]}},"required":["success","data"]},"IntegrationInvocationListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"operation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"operation_version_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"binding_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"connection_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"trigger":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["manual"]}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["dialog_flow"]},"source_id":{"type":"string"}},"required":["kind","source_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["automation"]},"source_id":{"type":"string"}},"required":["kind","source_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["replay"]},"source_id":{"type":"string"}},"required":["kind","source_id"],"additionalProperties":false}]},"replay_of_invocation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"root_invocation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"inputs":{"type":"object","additionalProperties":{}},"outputs":{"type":"object","additionalProperties":{}},"outcome":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"status":{"type":"string","enum":["queued","processing","retrying","waiting_provider","succeeded","failed","timed_out","indeterminate"]},"attempt_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"max_attempts":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"poll_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"next_poll_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"last_http_status":{"type":"integer","minimum":100,"maximum":599},"last_content_type":{"type":"string"},"last_error":{"type":"object","properties":{"code":{"type":"string","enum":["authorization_revoked","token_request_failed","invalid_token_response","destination_blocked","dns_failed","network_error","timeout","redirect_not_allowed","response_too_large","invalid_content_type","invalid_json","response_contract_mismatch","unmapped_response","ambiguous_outcome","rate_limited","internal_error"]},"retryable":{"type":"boolean"},"ambiguous":{"type":"boolean"}},"required":["code","retryable","ambiguous"]},"completed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"duration_ms":{"type":"integer","minimum":0,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","operation_id","operation_version_id","binding_id","connection_id","trigger","root_invocation_id","inputs","status","attempt_count","max_attempts","created_by"]}}},"required":["success","data"]},"IntegrationInvocationAttemptListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"invocation_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"attempt_number":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"status":{"type":"string","enum":["pending","succeeded","retryable_failure","failed","timed_out","indeterminate"]},"http_status":{"type":"integer","minimum":100,"maximum":599},"content_type":{"type":"string"},"outcome":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["authorization_revoked","token_request_failed","invalid_token_response","destination_blocked","dns_failed","network_error","timeout","redirect_not_allowed","response_too_large","invalid_content_type","invalid_json","response_contract_mismatch","unmapped_response","ambiguous_outcome","rate_limited","internal_error"]},"retryable":{"type":"boolean"},"ambiguous":{"type":"boolean"}},"required":["code","retryable","ambiguous"]},"started_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"completed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"duration_ms":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["_id","invocation_id","attempt_number","status","started_at","completed_at","duration_ms"]}}},"required":["success","data"]},"IntegrationValidationIssue":{"type":"object","required":["path","message"],"properties":{"path":{"type":"string"},"message":{"type":"string"}}},"IntegrationValidationError":{"type":"object","required":["success","error","issues"],"properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string"},"issues":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationValidationIssue"}}}},"CommercialCapabilityDefinition":{"type":"object","required":["key","name","description","supported_kinds"],"properties":{"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"supported_kinds":{"type":"array","items":{"type":"string","enum":["boolean","limit","allocation"]}},"workspace_tool_id":{"type":"string"}}},"CommercialPlanCapability":{"type":"object","required":["capability_key","kind","value","enforcement","period"],"properties":{"capability_key":{"type":"string"},"kind":{"type":"string","enum":["boolean","limit","allocation"]},"value":{"oneOf":[{"type":"boolean"},{"type":"integer","minimum":0}]},"enforcement":{"type":"string","enum":["hard_limit","soft_limit","observe_only"]},"period":{"type":"string","enum":["none","daily","monthly","billing_period"]}}},"CommercialPlanDefinition":{"type":"object","required":["id","code","version","name","status","capabilities"],"properties":{"id":{"type":"string"},"code":{"type":"string"},"version":{"type":"integer","minimum":1},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["draft","published","retired"]},"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/CommercialPlanCapability"}},"effective_from":{"type":"string","format":"date-time"},"replaces_plan_version_id":{"type":"string"},"published_at":{"type":"string","format":"date-time"},"retired_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"CommercialSubscription":{"type":"object","required":["id","plan_version_id","status","provider","started_at","current_period_start","version"],"properties":{"id":{"type":"string"},"plan_version_id":{"type":"string"},"status":{"type":"string","enum":["trial","active","grace_period","suspended","cancelled"]},"provider":{"type":"string","enum":["manual"]},"started_at":{"type":"string","format":"date-time"},"current_period_start":{"type":"string","format":"date-time"},"current_period_end":{"type":"string","format":"date-time"},"cancel_at":{"type":"string","format":"date-time"},"scheduled_action":{"type":"string","enum":["change","cancel"]},"scheduled_plan_version_id":{"type":"string"},"scheduled_for":{"type":"string","format":"date-time"},"version":{"type":"integer","minimum":1}}},"CommercialEffectiveEntitlement":{"allOf":[{"$ref":"#/components/schemas/CommercialPlanCapability"},{"type":"object","required":["source","plan_version_id","used"],"properties":{"source":{"type":"string","enum":["plan","override"]},"plan_version_id":{"type":"string"},"override_id":{"type":"string"},"valid_until":{"type":"string","format":"date-time"},"used":{"type":"integer","minimum":0},"remaining":{"type":"integer","minimum":0}}}]},"CommercialUsage":{"type":"object","required":["capability_key","used","limit","remaining","period","enforcement"],"properties":{"capability_key":{"type":"string"},"used":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":0},"remaining":{"type":"integer","minimum":0},"period":{"type":"string","enum":["none","daily","monthly","billing_period"]},"enforcement":{"type":"string","enum":["hard_limit","soft_limit","observe_only"]}}},"CommercialSnapshot":{"type":"object","properties":{"subscription":{"$ref":"#/components/schemas/CommercialSubscription","nullable":true},"plan":{"$ref":"#/components/schemas/CommercialPlanDefinition","nullable":true},"entitlements":{"type":"array","items":{"$ref":"#/components/schemas/CommercialEffectiveEntitlement"}},"usage":{"type":"array","items":{"$ref":"#/components/schemas/CommercialUsage"}}}},"CommercialSnapshotSuccess":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CommercialSnapshot"}}},"CommercialPlanSuccess":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CommercialPlanDefinition"}}},"CommercialPlanListSuccess":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/CommercialPlanDefinition"}}}},"CommercialCapabilityListSuccess":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/CommercialCapabilityDefinition"}}}},"GenericError":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"Error message"}},"required":["success","error"],"example":{"success":false,"error":"Cliente no encontrado"}},"GenericSuccess":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","additionalProperties":{}},"message":{"type":"string"}},"required":["success","data"]},"GenericListSuccess":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"type":"object","additionalProperties":{}}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"AuthorizationContextSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"actor":{"type":"object","properties":{"type":{"type":"string","enum":["user"]},"firebaseUid":{"type":"string"},"userId":{"type":"string","pattern":"^[a-f\\d]{24}$"}},"required":["type","firebaseUid","userId"]},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_membership_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_membership_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_role_ids":{"type":"array","items":{"type":"string","pattern":"^[a-f\\d]{24}$"}},"workspace_role_ids":{"type":"array","items":{"type":"string","pattern":"^[a-f\\d]{24}$"}},"role_ids":{"type":"array","items":{"type":"string","pattern":"^[a-f\\d]{24}$"}},"permission_keys":{"type":"array","items":{"type":"string"}},"team_ids":{"type":"array","items":{"type":"string","pattern":"^[a-f\\d]{24}$"}}},"required":["actor","business_id","business_membership_id","business_role_ids","workspace_role_ids","role_ids","permission_keys","team_ids"]}},"required":["success","data"]},"CustomRoleInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":500},"permission_keys":{"maxItems":100,"type":"array","items":{"type":"string"}}},"required":["name","permission_keys"]},"PermissionListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"role_scopes":{"type":"array","items":{"type":"string","enum":["business","workspace"]}},"delegable":{"type":"boolean"},"sensitive":{"type":"boolean"}},"required":["key","label","description","category","role_scopes","delegable","sensitive"]}}},"required":["success","data"]},"RoleSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"scope":{"type":"string","enum":["business","workspace"]},"permission_keys":{"type":"array","items":{"type":"string"}},"system":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","key","name","scope","permission_keys","system"]}},"required":["success","data"]},"RoleListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"scope":{"type":"string","enum":["business","workspace"]},"permission_keys":{"type":"array","items":{"type":"string"}},"system":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","key","name","scope","permission_keys","system"]}}},"required":["success","data"]},"MemberCreateInput":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"display_name":{"type":"string","minLength":1,"maxLength":120},"business_role_ids":{"minItems":1,"type":"array","items":{"type":"string","pattern":"^[a-f\\d]{24}$"}},"workspace_assignments":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"role_ids":{"minItems":1,"type":"array","items":{"type":"string","pattern":"^[a-f\\d]{24}$"}}},"required":["workspace_id","role_ids"]}}},"required":["email","business_role_ids"],"additionalProperties":false},"MemberBusinessRolesInput":{"type":"object","properties":{"role_ids":{"minItems":1,"type":"array","items":{"type":"string","pattern":"^[a-f\\d]{24}$"}}},"required":["role_ids"]},"MemberWorkspaceRolesInput":{"type":"object","properties":{"role_ids":{"minItems":1,"type":"array","items":{"type":"string","pattern":"^[a-f\\d]{24}$"}}},"required":["role_ids"]},"MemberSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"membership_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"user_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"display_name":{"type":"string"},"status":{"type":"string","enum":["invited","active","suspended"]},"roles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"key":{"type":"string"},"name":{"type":"string"},"system":{"type":"boolean"}},"required":["id","key","name","system"]}},"workspaces":{"type":"array","items":{"type":"object","properties":{"membership_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_name":{"type":"string"},"status":{"type":"string","enum":["invited","active","suspended"]},"roles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"key":{"type":"string"},"name":{"type":"string"},"system":{"type":"boolean"}},"required":["id","key","name","system"]}}},"required":["membership_id","workspace_id","workspace_name","status","roles"]}},"created_at":{"type":"string"}},"required":["membership_id","user_id","email","status","roles","workspaces"]}},"required":["success","data"]},"MemberListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"membership_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"user_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"display_name":{"type":"string"},"status":{"type":"string","enum":["invited","active","suspended"]},"roles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"key":{"type":"string"},"name":{"type":"string"},"system":{"type":"boolean"}},"required":["id","key","name","system"]}},"workspaces":{"type":"array","items":{"type":"object","properties":{"membership_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_name":{"type":"string"},"status":{"type":"string","enum":["invited","active","suspended"]},"roles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"key":{"type":"string"},"name":{"type":"string"},"system":{"type":"boolean"}},"required":["id","key","name","system"]}}},"required":["membership_id","workspace_id","workspace_name","status","roles"]}},"created_at":{"type":"string"}},"required":["membership_id","user_id","email","status","roles","workspaces"]}},"meta":{"type":"object","properties":{"total":{"type":"number"},"page":{"type":"number"},"limit":{"type":"number"},"total_pages":{"type":"number"}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"TeamInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"timezone":{"type":"string","minLength":1,"maxLength":100},"members":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"availability":{"default":[],"maxItems":21,"type":"array","items":{"type":"object","properties":{"day_of_week":{"type":"integer","minimum":1,"maximum":7},"start_minute":{"type":"integer","minimum":0,"maximum":1439},"end_minute":{"type":"integer","minimum":1,"maximum":1440}},"required":["day_of_week","start_minute","end_minute"],"additionalProperties":false}}},"required":["user_id"],"additionalProperties":false}},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["name","timezone","members"],"additionalProperties":false},"TeamSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","archived"]},"strategy":{"type":"string","enum":["round_robin"]},"timezone":{"type":"string"},"members":{"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"display_name":{"type":"string"},"availability":{"type":"array","items":{"type":"object","properties":{"day_of_week":{"type":"integer","minimum":1,"maximum":7},"start_minute":{"type":"integer","minimum":0,"maximum":1439},"end_minute":{"type":"integer","minimum":1,"maximum":1440}},"required":["day_of_week","start_minute","end_minute"],"additionalProperties":false}}},"required":["user_id","email","availability"]}},"routing_cursor":{"type":"integer","minimum":0,"maximum":9007199254740991},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"updated_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","status","strategy","timezone","members","routing_cursor","version","created_by","updated_by"]}},"required":["success","data"]},"TeamListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"business_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"workspace_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","archived"]},"strategy":{"type":"string","enum":["round_robin"]},"timezone":{"type":"string"},"members":{"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string","pattern":"^[a-f\\d]{24}$"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"display_name":{"type":"string"},"availability":{"type":"array","items":{"type":"object","properties":{"day_of_week":{"type":"integer","minimum":1,"maximum":7},"start_minute":{"type":"integer","minimum":0,"maximum":1439},"end_minute":{"type":"integer","minimum":1,"maximum":1440}},"required":["day_of_week","start_minute","end_minute"],"additionalProperties":false}}},"required":["user_id","email","availability"]}},"routing_cursor":{"type":"integer","minimum":0,"maximum":9007199254740991},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"updated_by":{"type":"string","pattern":"^[a-f\\d]{24}$"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","status","strategy","timezone","members","routing_cursor","version","created_by","updated_by"]}}},"required":["success","data"]},"PaymentCouponCreateInput":{"type":"object","properties":{"contact_id":{"type":"string","description":"Cliente existente. Si no se envia, se puede adjuntar `customer` para crear o resolver el cliente en la misma llamada."},"customer":{"description":"Datos del contacto para crear su primer cupon en una sola llamada cuando aun no existe contact_id."},"payment_coupon_code":{"type":"string","minLength":1,"maxLength":14,"pattern":"^[A-Za-z0-9]+$"},"currency":{"type":"string","enum":["PEN"],"description":"360Pay opera actualmente solo en soles peruanos (PEN)."},"amount":{"type":"number","example":150.5},"external_ref":{"type":"string","example":"ORD-9988","description":"Referencia externa unica por negocio. Si se omite, se genera una automaticamente."},"description":{"type":"string","example":"Pago de membresia"},"issue_date":{"type":"string","format":"date-time"},"expiry_date":{"type":"string","format":"date-time"},"payment_date":{"type":"string","format":"date-time"}},"required":["amount","expiry_date"],"additionalProperties":{}},"ContextualPaymentCouponCreateInput":{"type":"object","properties":{"origin_type":{"type":"string","enum":["case","order","receivable","conversation"]},"origin_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"idempotency_key":{"type":"string","minLength":1,"maxLength":160},"amount":{"type":"number","minimum":0,"exclusiveMinimum":true},"currency":{"type":"string","enum":["PEN"],"description":"360Pay opera actualmente solo en soles peruanos (PEN)."},"description":{"type":"string","minLength":1,"maxLength":500},"expires_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["origin_type","origin_id","idempotency_key"],"additionalProperties":false},"PaymentCouponUpdateInput":{"type":"object","properties":{"amount":{"type":"number","example":150.5},"currency":{"type":"string","enum":["PEN"],"description":"360Pay opera actualmente solo en soles peruanos (PEN)."},"description":{"type":"string","example":"Pago de membresia"},"status":{"type":"string","example":"paid"},"issue_date":{"type":"string","format":"date-time"},"expiry_date":{"type":"string","format":"date-time"},"paid_at":{"type":"string","format":"date-time"},"payment_date":{"type":"string","format":"date-time"},"bank_tx_id":{"type":"string","example":"BCP"},"operation_number":{"type":"string","example":"OP-12345"},"payment_coupon_code":{"type":"string","minLength":1,"maxLength":14,"pattern":"^[A-Za-z0-9]+$"},"external_ref":{"type":"string","example":"ORD-9988"}},"additionalProperties":{}},"PaymentCouponImportRow":{"type":"object","properties":{"tipo_documento":{"type":"string"},"cliente_id":{"type":"string"},"documento_identidad":{"anyOf":[{"type":"string"},{"type":"number"}]},"nombre_cliente":{"type":"string"},"email_cliente":{"type":"string"},"telefono_cliente":{"anyOf":[{"type":"string"},{"type":"number"}]},"referencia_externa":{"type":"string"},"monto":{"anyOf":[{"type":"string"},{"type":"number"}]},"descripcion":{"type":"string"},"fecha_expiracion":{"type":"string"},"codigo_cupon":{"anyOf":[{"type":"string"},{"type":"number"}]},"customer_document_type":{"type":"string"},"contact_id":{"type":"string"},"customer_document_number":{"anyOf":[{"type":"string"},{"type":"number"}]},"customer_name":{"type":"string"},"customer_email":{"type":"string"},"customer_phone":{"anyOf":[{"type":"string"},{"type":"number"}]},"external_ref":{"type":"string"},"amount":{"anyOf":[{"type":"string"},{"type":"number"}]},"description":{"type":"string"},"expiry_date":{"type":"string"},"payment_coupon_code":{"anyOf":[{"type":"string"},{"type":"number"}]}},"additionalProperties":{}},"PaymentCouponImportObject":{"type":"object","additionalProperties":false,"required":["coupons"],"properties":{"coupons":{"type":"array","items":{"$ref":"#/components/schemas/PaymentCouponImportRow"}}}},"PaymentCouponImportInput":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/PaymentCouponImportRow"}},{"$ref":"#/components/schemas/PaymentCouponImportObject"}]},"PaymentCouponImportMultipartInput":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"Archivo CSV UTF-8. Se aceptan delimitadores coma o punto y coma."}}},"PaymentCoupon":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"receivable_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"origin_type":{"type":"string","enum":["standalone","case","order","receivable","conversation","assistant"]},"origin_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"amount":{"type":"number"},"payment_method":{"type":"string","enum":["360pay"]},"currency":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","paid","voided"]},"issue_date":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"expiry_date":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"payment_date":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"paid_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"payment_coupon_code":{"type":"string"},"customer_name":{"type":"string"},"external_ref":{"type":"string"},"operation_number":{"type":"string"},"payment_reference":{"type":"string"},"settlement_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"settlement_status":{"type":"string"},"settlement_date":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"bank_tx_id":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","amount","status"]},"PaymentCouponSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/PaymentCoupon"}},"required":["success","data"]},"PaymentCouponListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/PaymentCoupon"}},"meta":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_pages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"PaymentCouponMetricsSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"total_amount":{"type":"number"},"total_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status_breakdown":{"type":"object","additionalProperties":{"type":"object","properties":{"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount":{"type":"number"}},"required":["count","amount"]}}},"required":["total_amount","total_count","status_breakdown"]}},"required":["success","data"]},"PaymentCouponImportSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"success":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"errors":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"error":{"type":"string"},"data":{"type":"object","additionalProperties":{}}},"required":["row","error","data"]}}},"required":["total","success","failed","errors"]}},"required":["success","data"]},"CollectionReceivableCreateInput":{"type":"object","properties":{"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"external_ref":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","minLength":1,"maxLength":500},"amount":{"type":"number","minimum":0,"exclusiveMinimum":true,"multipleOf":0.01},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"due_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"policy_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["contact_id","external_ref","description","amount","currency"],"additionalProperties":false},"CollectionReceivableSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"external_ref":{"type":"string"},"description":{"type":"string"},"currency":{"type":"string"},"amount_due":{"type":"number"},"amount_paid":{"type":"number"},"status":{"type":"string","enum":["open","partially_paid","paid","voided"]},"due_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"policy_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"active_conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"history":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["created","coupon_issued","payment_applied","reminder_scheduled","reminder_queued","reminder_sent","reminder_delivered","reminder_read","customer_responded","promise_recorded","dispute_opened","voided"]},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"actor_type":{"type":"string","enum":["user","system","assistant"]},"actor_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"payment_coupon_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"amount":{"type":"number"},"metadata":{"type":"object","additionalProperties":{}}},"required":["type","at","actor_type"]}},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"updated_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","contact_id","external_ref","description","currency","amount_due","amount_paid","status","history","version","created_by","updated_by"]}},"required":["success","data"]},"CollectionReceivableListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"external_ref":{"type":"string"},"description":{"type":"string"},"currency":{"type":"string"},"amount_due":{"type":"number"},"amount_paid":{"type":"number"},"status":{"type":"string","enum":["open","partially_paid","paid","voided"]},"due_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"policy_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"active_conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"history":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["created","coupon_issued","payment_applied","reminder_scheduled","reminder_queued","reminder_sent","reminder_delivered","reminder_read","customer_responded","promise_recorded","dispute_opened","voided"]},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"actor_type":{"type":"string","enum":["user","system","assistant"]},"actor_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"payment_coupon_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"amount":{"type":"number"},"metadata":{"type":"object","additionalProperties":{}}},"required":["type","at","actor_type"]}},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"updated_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","contact_id","external_ref","description","currency","amount_due","amount_paid","status","history","version","created_by","updated_by"]}},"meta":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_pages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"CollectionAttemptCreateInput":{"type":"object","properties":{"scheduled_for":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"workspace_channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"whatsapp_template_binding_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"include_payment_coupon":{"default":false,"type":"boolean"},"idempotency_key":{"type":"string","minLength":1,"maxLength":200}},"required":["scheduled_for","workspace_channel_id","whatsapp_template_binding_id","idempotency_key"],"additionalProperties":false},"CollectionAttemptSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"receivable_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"scheduled_for":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"workspace_channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"whatsapp_template_binding_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"include_payment_coupon":{"type":"boolean"},"idempotency_key":{"type":"string"},"status":{"type":"string","enum":["scheduled","dispatching","queued","sent","delivered","read","responded","failed","cancelled"]},"message_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"payment_coupon_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","receivable_id","contact_id","scheduled_for","workspace_channel_id","whatsapp_template_binding_id","include_payment_coupon","idempotency_key","status","attempts","created_by"]}},"required":["success","data"]},"CollectionAttemptListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"receivable_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"scheduled_for":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"workspace_channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"whatsapp_template_binding_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"include_payment_coupon":{"type":"boolean"},"idempotency_key":{"type":"string"},"status":{"type":"string","enum":["scheduled","dispatching","queued","sent","delivered","read","responded","failed","cancelled"]},"message_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"payment_coupon_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","receivable_id","contact_id","scheduled_for","workspace_channel_id","whatsapp_template_binding_id","include_payment_coupon","idempotency_key","status","attempts","created_by"]}}},"required":["success","data"]},"CollectionPolicyCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"status":{"default":"active","type":"string","enum":["draft","active"]},"steps":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":80},"offset_days":{"type":"integer","minimum":-365,"maximum":365},"workspace_channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"whatsapp_template_binding_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"include_payment_coupon":{"default":false,"type":"boolean"}},"required":["id","offset_days","workspace_channel_id","whatsapp_template_binding_id"],"additionalProperties":false}}},"required":["name","steps"],"additionalProperties":false},"CollectionPolicySuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["draft","active","paused"]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"offset_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"workspace_channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"whatsapp_template_binding_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"include_payment_coupon":{"type":"boolean"}},"required":["id","offset_days","workspace_channel_id","whatsapp_template_binding_id","include_payment_coupon"]}},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"updated_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","name","status","steps","revision","created_by","updated_by"]}},"required":["success","data"]},"CollectionPolicyListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["draft","active","paused"]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"offset_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"workspace_channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"whatsapp_template_binding_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"include_payment_coupon":{"type":"boolean"}},"required":["id","offset_days","workspace_channel_id","whatsapp_template_binding_id","include_payment_coupon"]}},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"updated_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","name","status","steps","revision","created_by","updated_by"]}}},"required":["success","data"]},"CollectionsDashboardSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"period":{"type":"object","properties":{"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"previous_from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"previous_to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["from","to","previous_from","previous_to"]},"currencies":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"metrics":{"type":"object","properties":{"collected":{"type":"object","properties":{"value":{"type":"number"},"previous_value":{"type":"number"},"change_percent":{"nullable":true,"type":"number"}},"required":["value","previous_value","change_percent"]},"pending":{"type":"object","properties":{"value":{"type":"number"},"previous_value":{"type":"number"},"change_percent":{"nullable":true,"type":"number"}},"required":["value","previous_value","change_percent"]},"overdue":{"type":"object","properties":{"value":{"type":"number"},"previous_value":{"type":"number"},"change_percent":{"nullable":true,"type":"number"}},"required":["value","previous_value","change_percent"]},"active_promises":{"type":"object","properties":{"value":{"type":"number"},"previous_value":{"type":"number"},"change_percent":{"nullable":true,"type":"number"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"previous_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"count_change_percent":{"nullable":true,"type":"number"}},"required":["value","previous_value","change_percent","count","previous_count","count_change_percent"]},"recovery_rate":{"type":"object","properties":{"value":{"type":"number"},"previous_value":{"type":"number"},"change_percent":{"nullable":true,"type":"number"}},"required":["value","previous_value","change_percent"]},"reminders_sent":{"type":"object","properties":{"value":{"type":"number"},"previous_value":{"type":"number"},"change_percent":{"nullable":true,"type":"number"}},"required":["value","previous_value","change_percent"]}},"required":["collected","pending","overdue","active_promises","recovery_rate","reminders_sent"]},"funnel":{"type":"array","items":{"type":"object","properties":{"stage":{"type":"string","enum":["in_management","notified","delivered","viewed","responded","paid","reconciled"]},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"amount":{"type":"number"},"percentage":{"type":"number"}},"required":["stage","count","amount","percentage"]}},"aging":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string","enum":["0_30","31_60","61_90","90_plus"]},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"amount":{"type":"number"},"percentage":{"type":"number"}},"required":["bucket","count","amount","percentage"]}},"recovery_evolution":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"amount":{"type":"number"},"cumulative_amount":{"type":"number"}},"required":["date","amount","cumulative_amount"]}},"critical_contacts":{"type":"array","items":{"type":"object","properties":{"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"overdue_amount":{"type":"number"},"max_days_overdue":{"type":"integer","minimum":0,"maximum":9007199254740991},"receivables_count":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"has_dispute":{"type":"boolean"},"has_broken_promise":{"type":"boolean"}},"required":["contact_id","name","overdue_amount","max_days_overdue","receivables_count","has_dispute","has_broken_promise"]}},"coupon_conversion":{"type":"array","items":{"type":"object","properties":{"stage":{"type":"string","enum":["generated","notified","viewed","paid"]},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"amount":{"type":"number"},"percentage":{"type":"number"}},"required":["stage","count","amount","percentage"]}},"reminder_performance":{"type":"object","properties":{"scheduled":{"type":"integer","minimum":0,"maximum":9007199254740991},"sent":{"type":"integer","minimum":0,"maximum":9007199254740991},"delivered":{"type":"integer","minimum":0,"maximum":9007199254740991},"viewed":{"type":"integer","minimum":0,"maximum":9007199254740991},"responded":{"type":"integer","minimum":0,"maximum":9007199254740991},"failed":{"type":"integer","minimum":0,"maximum":9007199254740991},"cancelled":{"type":"integer","minimum":0,"maximum":9007199254740991},"payment_conversions":{"type":"integer","minimum":0,"maximum":9007199254740991},"recovered_amount":{"type":"number"}},"required":["scheduled","sent","delivered","viewed","responded","failed","cancelled","payment_conversions","recovered_amount"]}},"required":["currency","metrics","funnel","aging","recovery_evolution","critical_contacts","coupon_conversion","reminder_performance"]}}},"required":["period","currencies"]}},"required":["success","data"]},"CollectionRecordListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"archived":{"type":"boolean"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","name","archived"]},"external_ref":{"type":"string"},"description":{"type":"string"},"currency":{"type":"string"},"amount_due":{"type":"number"},"amount_paid":{"type":"number"},"outstanding":{"type":"number"},"payment_status":{"type":"string","enum":["pending","partial","paid","voided"]},"status":{"type":"string","enum":["open","partially_paid","paid","voided"]},"due_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"days_overdue":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_reminder_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"last_channel":{"type":"string","enum":["whatsapp"]},"last_result":{"type":"string","enum":["scheduled","dispatching","queued","sent","delivered","read","responded","failed","cancelled"]},"active_conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"payment_coupon_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"promise":{"type":"object","properties":{"promised_for":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"amount":{"type":"number"},"note":{"type":"string"},"recorded_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["promised_for","recorded_at"]},"dispute":{"type":"object","properties":{"reason":{"type":"string"},"opened_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["reason","opened_at"]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","contact","external_ref","description","currency","amount_due","amount_paid","outstanding","payment_status","status","days_overdue"]}},"meta":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_pages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"CollectionTimelineSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"actor_type":{"type":"string","enum":["user","system","assistant"]},"status":{"type":"string","enum":["scheduled","dispatching","queued","sent","delivered","read","responded","failed","cancelled"]},"amount":{"type":"number"},"channel":{"type":"string","enum":["whatsapp"]},"message_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"payment_coupon_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"metadata":{"type":"object","additionalProperties":{}}},"required":["id","type","at","actor_type"]}}},"required":["success","data"]},"CollectionManualPaymentInput":{"type":"object","properties":{"amount":{"type":"number","minimum":0,"exclusiveMinimum":true,"multipleOf":0.01}},"required":["amount"],"additionalProperties":false},"CollectionPaymentPromiseInput":{"type":"object","properties":{"promised_for":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"amount":{"type":"number","minimum":0,"exclusiveMinimum":true,"multipleOf":0.01},"note":{"type":"string","maxLength":500}},"required":["promised_for"],"additionalProperties":false},"CollectionDisputeInput":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["reason"],"additionalProperties":false},"CollectionsKanban":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"module_id":{"type":"string","enum":["collections"]},"is_primary":{"type":"boolean"},"columns":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"column_type":{"type":"string","enum":["open","terminal"]},"terminal_classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"color":{"type":"string"}},"required":["_id","name","position","column_type"]}}},"required":["_id","name","module_id","is_primary","columns"]},"CollectionsKanbanListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"module_id":{"type":"string","enum":["collections"]},"is_primary":{"type":"boolean"},"columns":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"column_type":{"type":"string","enum":["open","terminal"]},"terminal_classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"color":{"type":"string"}},"required":["_id","name","position","column_type"]}}},"required":["_id","name","module_id","is_primary","columns"]}}},"required":["success","data"]},"CollectionCaseCreateInput":{"type":"object","properties":{"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"receivable_ids":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"responsible_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"next_action_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["contact_id","receivable_ids","kanban_id","column_id","title"],"additionalProperties":false},"CollectionCaseManagementInput":{"type":"object","properties":{"responsible_user_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"next_action_at":{"nullable":true,"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["expected_version"],"additionalProperties":false},"CollectionCaseTransitionInput":{"type":"object","properties":{"to_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"idempotency_key":{"type":"string","minLength":1,"maxLength":200},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["to_column_id","expected_version","idempotency_key"],"additionalProperties":false},"CollectionCaseReopenInput":{"type":"object","properties":{"to_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"idempotency_key":{"type":"string","minLength":1,"maxLength":200},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["to_column_id","expected_version","idempotency_key"],"additionalProperties":false},"CollectionCase":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"receivable_ids":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string"},"responsible_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"next_action_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"active_conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"status":{"type":"string","enum":["open","closed"]},"classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"closed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"source":{"type":"string","enum":["receivable","policy","manual"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"updated_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"contact":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","name"]},"balances":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"amount_due":{"type":"number"},"amount_paid":{"type":"number"},"outstanding":{"type":"number"}},"required":["currency","amount_due","amount_paid","outstanding"]}}},"required":["_id","business_id","workspace_id","contact_id","receivable_ids","kanban_id","column_id","title","status","source","version","created_by","contact","balances"]},"CollectionCaseSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"receivable_ids":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string"},"responsible_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"next_action_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"active_conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"status":{"type":"string","enum":["open","closed"]},"classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"closed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"source":{"type":"string","enum":["receivable","policy","manual"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"updated_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"contact":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","name"]},"balances":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"amount_due":{"type":"number"},"amount_paid":{"type":"number"},"outstanding":{"type":"number"}},"required":["currency","amount_due","amount_paid","outstanding"]}}},"required":["_id","business_id","workspace_id","contact_id","receivable_ids","kanban_id","column_id","title","status","source","version","created_by","contact","balances"]}},"required":["success","data"]},"CollectionCaseListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"receivable_ids":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string"},"responsible_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"next_action_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"active_conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"status":{"type":"string","enum":["open","closed"]},"classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"closed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"source":{"type":"string","enum":["receivable","policy","manual"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"updated_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"contact":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","name"]},"balances":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"amount_due":{"type":"number"},"amount_paid":{"type":"number"},"outstanding":{"type":"number"}},"required":["currency","amount_due","amount_paid","outstanding"]}}},"required":["_id","business_id","workspace_id","contact_id","receivable_ids","kanban_id","column_id","title","status","source","version","created_by","contact","balances"]}},"meta":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_pages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"CollectionCaseBoardSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"columns":{"type":"array","items":{"type":"object","properties":{"column":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"column_type":{"type":"string","enum":["open","terminal"]},"terminal_classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"color":{"type":"string"}},"required":["_id","name","position","column_type"]},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"cases":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"receivable_ids":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string"},"responsible_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"next_action_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"active_conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"status":{"type":"string","enum":["open","closed"]},"classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"closed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"source":{"type":"string","enum":["receivable","policy","manual"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"updated_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"contact":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","name"]},"balances":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"amount_due":{"type":"number"},"amount_paid":{"type":"number"},"outstanding":{"type":"number"}},"required":["currency","amount_due","amount_paid","outstanding"]}}},"required":["_id","business_id","workspace_id","contact_id","receivable_ids","kanban_id","column_id","title","status","source","version","created_by","contact","balances"]}}},"required":["column","total","cases"]}}},"required":["kanban_id","columns"]}},"required":["success","data"]},"CollectionCaseTransition":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"collection_case_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"from_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"from_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"actor_type":{"type":"string","enum":["user","system","assistant"]},"actor_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"idempotency_key":{"type":"string"},"trigger":{"type":"string","enum":["created","receivable_linked","manual","reminder","customer_response","promise","dispute","payment","referred","reopened"]},"reason":{"type":"string"},"from_version":{"type":"integer","minimum":0,"maximum":9007199254740991},"to_version":{"type":"integer","minimum":0,"maximum":9007199254740991},"resulting_status":{"type":"string","enum":["open","closed"]},"resulting_classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"occurred_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","collection_case_id","from_kanban_id","to_kanban_id","from_column_id","to_column_id","actor_type","idempotency_key","trigger","from_version","to_version","resulting_status","occurred_at"]},"CollectionCaseTransitionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"transition":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"collection_case_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"from_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"from_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"actor_type":{"type":"string","enum":["user","system","assistant"]},"actor_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"idempotency_key":{"type":"string"},"trigger":{"type":"string","enum":["created","receivable_linked","manual","reminder","customer_response","promise","dispute","payment","referred","reopened"]},"reason":{"type":"string"},"from_version":{"type":"integer","minimum":0,"maximum":9007199254740991},"to_version":{"type":"integer","minimum":0,"maximum":9007199254740991},"resulting_status":{"type":"string","enum":["open","closed"]},"resulting_classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"occurred_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","collection_case_id","from_kanban_id","to_kanban_id","from_column_id","to_column_id","actor_type","idempotency_key","trigger","from_version","to_version","resulting_status","occurred_at"]},"idempotent_replay":{"type":"boolean"}},"required":["transition","idempotent_replay"]}},"required":["success","data"]},"CollectionCaseTransitionListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"collection_case_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"from_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"from_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"actor_type":{"type":"string","enum":["user","system","assistant"]},"actor_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"idempotency_key":{"type":"string"},"trigger":{"type":"string","enum":["created","receivable_linked","manual","reminder","customer_response","promise","dispute","payment","referred","reopened"]},"reason":{"type":"string"},"from_version":{"type":"integer","minimum":0,"maximum":9007199254740991},"to_version":{"type":"integer","minimum":0,"maximum":9007199254740991},"resulting_status":{"type":"string","enum":["open","closed"]},"resulting_classification":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]},"occurred_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","collection_case_id","from_kanban_id","to_kanban_id","from_column_id","to_column_id","actor_type","idempotency_key","trigger","from_version","to_version","resulting_status","occurred_at"]}},"meta":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_pages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"Settlement":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"source_account":{"type":"string"},"destination_account":{"type":"string"},"destination_bank":{"type":"string"},"payment_coupons_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_amount":{"type":"number"},"commission_amount":{"type":"number"},"total_paid":{"type":"number"},"status":{"type":"string","enum":["IN_PROCESS","COMPLETED","REJECTED"]},"transaction_date":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"bank_transaction_id":{"type":"string"},"batch_id":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","source_account","destination_account","destination_bank","payment_coupons_count","total_amount","commission_amount","total_paid","status"]},"SettlementSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/Settlement"}},"required":["success","data"]},"SettlementListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Settlement"}},"meta":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_pages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"PaymentsDashboard":{"type":"object","properties":{"monthly_income":{"type":"number"},"active_payment_coupons_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"voided_payment_coupons_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"expired_payment_coupons_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"new_customers_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount_to_settle":{"type":"number"},"weekly_income":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"amount":{"type":"number"}},"required":["date","amount"]}},"last_settlements":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"source_account":{"type":"string"},"destination_account":{"type":"string"},"destination_bank":{"type":"string"},"payment_coupons_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_amount":{"type":"number"},"commission_amount":{"type":"number"},"total_paid":{"type":"number"},"status":{"type":"string","enum":["IN_PROCESS","COMPLETED","REJECTED"]},"transaction_date":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"bank_transaction_id":{"type":"string"},"batch_id":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","source_account","destination_account","destination_bank","payment_coupons_count","total_amount","commission_amount","total_paid","status"]}}},"required":["monthly_income","active_payment_coupons_count","voided_payment_coupons_count","expired_payment_coupons_count","new_customers_count","amount_to_settle","weekly_income","last_settlements"]},"PaymentsDashboardSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/PaymentsDashboard"}},"required":["success","data"]},"BusinessHookCreateInput":{"type":"object","properties":{"type":{"type":"string","enum":["PAYMENT_PAID"]},"url":{"type":"string","maxLength":2048},"headers":{"type":"object","additionalProperties":{"type":"string","maxLength":2048}},"include_unmapped_fields":{"type":"boolean"},"payload_mapping":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":200},"description":"Mapa sourcePath → targetPath. Las rutas anidadas usan puntos; por ejemplo, `data.amount` → `payment.amount`."},"additional_fields":{"type":"object","additionalProperties":{}},"active":{"type":"boolean"}},"required":["type","url"],"additionalProperties":false},"BusinessHookUpdateInput":{"type":"object","properties":{"type":{"type":"string","enum":["PAYMENT_PAID"]},"url":{"type":"string","maxLength":2048},"headers":{"type":"object","additionalProperties":{"type":"string","maxLength":2048}},"include_unmapped_fields":{"type":"boolean"},"payload_mapping":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":200},"description":"Mapa sourcePath → targetPath. Las rutas anidadas usan puntos; por ejemplo, `data.amount` → `payment.amount`."},"additional_fields":{"type":"object","additionalProperties":{}},"active":{"type":"boolean"}},"additionalProperties":false},"BusinessHook":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"type":{"type":"string","enum":["PAYMENT_PAID"]},"url":{"type":"string"},"header_names":{"type":"array","items":{"type":"string"}},"payload_mapping":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":200},"description":"Mapa sourcePath → targetPath. Las rutas anidadas usan puntos; por ejemplo, `data.amount` → `payment.amount`."},"include_unmapped_fields":{"type":"boolean"},"additional_fields":{"type":"object","additionalProperties":{}},"signing_secret_preview":{"type":"string"},"signing_secret_version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","type","url","active","created_at","updated_at"]},"BusinessHookSecret":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"type":{"type":"string","enum":["PAYMENT_PAID"]},"url":{"type":"string"},"header_names":{"type":"array","items":{"type":"string"}},"payload_mapping":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":200},"description":"Mapa sourcePath → targetPath. Las rutas anidadas usan puntos; por ejemplo, `data.amount` → `payment.amount`."},"include_unmapped_fields":{"type":"boolean"},"additional_fields":{"type":"object","additionalProperties":{}},"signing_secret_preview":{"type":"string"},"signing_secret_version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"signing_secret":{"type":"string"}},"required":["_id","business_id","type","url","active","created_at","updated_at","signing_secret"]},"BusinessHookSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/BusinessHook"}},"required":["success","data"]},"BusinessHookSecretSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/BusinessHookSecret"}},"required":["success","data"]},"BusinessHookListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/BusinessHook"}}},"required":["success","data"]},"WebhookDelivery":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"hook_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"event_id":{"type":"string"},"event_type":{"type":"string","enum":["PAYMENT_PAID","WEBHOOK_TEST"]},"resource_type":{"type":"string","enum":["payment_coupon","webhook_test"]},"resource_id":{"type":"string"},"payload":{"type":"object","additionalProperties":{}},"payload_hash":{"type":"string"},"url":{"type":"string"},"signing_secret_preview":{"type":"string"},"status":{"type":"string","enum":["pending","processing","retrying","delivered","dead","canceled","enqueue_failed"]},"attempt_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max_attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"task_id":{"type":"string"},"last_attempted_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"delivered_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"last_http_status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_error":{"type":"string"},"response_preview":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","hook_id","business_id","event_id","event_type","resource_type","resource_id","payload","payload_hash","url","status","attempt_count","max_attempts","created_at","updated_at"]},"WebhookDeliverySuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/WebhookDelivery"}},"required":["success","data"]},"WebhookDeliveryListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"meta":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_pages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","total_pages"]}},"required":["success","data","meta"]},"AppBusinessSummary":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"address":{"type":"string"},"payment_prefix":{"type":"string"},"destination_account":{"type":"string"},"destination_bank":{"type":"string"},"status":{"type":"string","enum":["active","pending_activation","suspended","archived"]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"is_active":{"type":"boolean"}},"required":["_id","name","payment_prefix","is_active"]},"AppBusinessUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","minLength":1,"maxLength":40},"address":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"AppBusinessesMeMeta":{"type":"object","properties":{"active_business_id":{"type":"string"}},"required":["active_business_id"]},"AppBusinessesMeSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AppBusinessSummary"}},"meta":{"$ref":"#/components/schemas/AppBusinessesMeMeta"}},"required":["success","data","meta"]},"WorkspaceCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"purpose":{"type":"string","enum":["sales","post_sales","collections","general","custom"]},"purpose_label":{"type":"string","minLength":1},"settings":{"type":"object","additionalProperties":{}}},"required":["name","purpose"],"additionalProperties":false},"WorkspaceUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"settings":{"type":"object","additionalProperties":{}}},"additionalProperties":false},"WorkspaceOnboardingCompleteInput":{"type":"object","properties":{"purpose":{"type":"string","enum":["sales","post_sales","collections","general","custom"]},"purpose_label":{"type":"string","minLength":1},"tool_ids":{"maxItems":32,"type":"array","items":{"type":"string","minLength":1}}},"required":["purpose"],"additionalProperties":false},"Workspace":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"purpose":{"type":"string","enum":["sales","post_sales","collections","general","custom"]},"purpose_label":{"type":"string"},"primary_kanban_id":{"type":"string"},"status":{"type":"string","enum":["pending_activation","active","inactive"]},"settings":{"type":"object","additionalProperties":{}},"onboarding_status":{"type":"string","enum":["in_progress","completed"]},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","name","status","settings","onboarding_status","created_by"]},"WorkspaceSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"purpose":{"type":"string","enum":["sales","post_sales","collections","general","custom"]},"purpose_label":{"type":"string"},"primary_kanban_id":{"type":"string"},"status":{"type":"string","enum":["pending_activation","active","inactive"]},"settings":{"type":"object","additionalProperties":{}},"onboarding_status":{"type":"string","enum":["in_progress","completed"]},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","name","status","settings","onboarding_status","created_by"]},"message":{"type":"string"}},"required":["success","data"]},"WorkspaceOnboardingStateSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"workspace":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"purpose":{"type":"string","enum":["sales","post_sales","collections","general","custom"]},"purpose_label":{"type":"string"},"primary_kanban_id":{"type":"string"},"status":{"type":"string","enum":["pending_activation","active","inactive"]},"settings":{"type":"object","additionalProperties":{}},"onboarding_status":{"type":"string","enum":["in_progress","completed"]},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","name","status","settings","onboarding_status","created_by"]},"templates":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string","enum":["sales","post_sales","collections","general","custom"]},"name":{"type":"string"},"description":{"type":"string"},"process_name":{"type":"string"},"default_case_type_name":{"type":"string"},"recommended_tool_ids":{"type":"array","items":{"type":"string"}},"classifications":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"outcome":{"type":"string","enum":["positive","negative","cancelled","neutral"]}},"required":["key","label","outcome"]}},"stages":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"stage_type":{"type":"string","enum":["open","terminal"]},"terminal_classification":{"type":"string","minLength":1},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"}},"required":["name","stage_type"],"additionalProperties":false}}},"required":["purpose","name","description","process_name","default_case_type_name","recommended_tool_ids","classifications","stages"]}},"goals":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"tool_ids":{"type":"array","items":{"type":"string"}}},"required":["key","label","description","tool_ids"]}}},"required":["workspace","templates","goals"]}},"required":["success","data"]},"ContactSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/ContactWithCustomFields"},"message":{"type":"string"}},"required":["success","data"]},"ContactListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ContactWithCustomFields"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"ContactArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]},"ContactCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","maxLength":32},"phone_country_code":{"type":"string","minLength":2,"maxLength":2},"document_type":{"type":"string","minLength":1,"maxLength":32},"document_number":{"type":"string","minLength":1,"maxLength":64},"payment_coupon_code":{"type":"string","minLength":1,"maxLength":14,"pattern":"^[A-Za-z0-9]+$"}},"required":["name"]},"ContactUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","maxLength":32},"phone_country_code":{"type":"string","minLength":2,"maxLength":2},"document_type":{"type":"string","minLength":1,"maxLength":32},"document_number":{"type":"string","minLength":1,"maxLength":64},"payment_coupon_code":{"type":"string","minLength":1,"maxLength":14,"pattern":"^[A-Za-z0-9]+$"},"clear_email":{"type":"boolean","enum":[true]},"clear_phone":{"type":"boolean","enum":[true]},"clear_document":{"type":"boolean","enum":[true]}}},"ContactMergeInput":{"type":"object","properties":{"source_contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"phone_country_code":{"type":"string","minLength":2,"maxLength":2}},"required":["source_contact_id"]},"ContactMergeSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/ContactWithCustomFields"},"meta":{"type":"object","properties":{"source_contact_id":{"type":"string"},"idempotent_replay":{"type":"boolean"}},"required":["source_contact_id","idempotent_replay"]},"message":{"type":"string"}},"required":["success","data","meta","message"]},"ContactActivityEvent":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"contact_id":{"type":"string"},"organization_id":{"type":"string"},"workspace_id":{"type":"string"},"actor_user_id":{"type":"string"},"actor_firebase_uid":{"type":"string"},"event_type":{"type":"string","enum":["person.created","person.updated","person.archived","person.merged","note.created","note.updated","note.deleted","case.transitioned","organization.created","organization.updated","organization.archived","person.organization-linked","person.organization-unlinked","party.product-linked","party.product-unlinked"]},"visibility":{"type":"string","enum":["business","workspace"]},"data":{"type":"object","additionalProperties":{}},"occurred_at":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","business_id","event_type","visibility","data","occurred_at"]},"ContactActivityListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ContactActivityEvent"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"ContactNote":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"contact_id":{"type":"string"},"conversation_id":{"type":"string"},"case_id":{"type":"string"},"content":{"type":"string"},"author_user_id":{"type":"string"},"author_name":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"can_edit":{"type":"boolean"},"can_delete":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","contact_id","content","author_user_id","author_name","version","can_edit","can_delete","created_at","updated_at"]},"ContactNoteCreateInput":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":4000}},"required":["content"]},"ContactNoteUpdateInput":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":4000},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["content","expected_version"]},"ContactNoteSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"contact_id":{"type":"string"},"conversation_id":{"type":"string"},"case_id":{"type":"string"},"content":{"type":"string"},"author_user_id":{"type":"string"},"author_name":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"can_edit":{"type":"boolean"},"can_delete":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","contact_id","content","author_user_id","author_name","version","can_edit","can_delete","created_at","updated_at"]}},"required":["success","data"]},"ContactNoteListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"contact_id":{"type":"string"},"conversation_id":{"type":"string"},"case_id":{"type":"string"},"content":{"type":"string"},"author_user_id":{"type":"string"},"author_name":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"can_edit":{"type":"boolean"},"can_delete":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","contact_id","content","author_user_id","author_name","version","can_edit","can_delete","created_at","updated_at"]}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"ContactNoteDeleteSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]},"ContactTagCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"}},"required":["name"]},"ContactTagUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"clear_color":{"type":"boolean","enum":[true]}}},"ContactTagAssignmentInput":{"type":"object","properties":{"tag_ids":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}},"required":["tag_ids"]},"ContactTag":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"name":{"type":"string"},"normalized_name":{"type":"string"},"color":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","name","normalized_name","created_by"]},"ContactTagSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/ContactTag"},"message":{"type":"string"}},"required":["success","data"]},"ContactTagListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ContactTag"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"ContactTagCollectionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ContactTag"}}},"required":["success","data"]},"ContactWithTags":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"contact_external_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"phone_country_code":{"type":"string"},"document_type":{"type":"string"},"document_number":{"type":"string"},"payment_coupon_code":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}},"whatsapp":{"type":"object","properties":{"reachable":{"type":"boolean"},"has_phone":{"type":"boolean"},"username":{"type":"string"},"country_code":{"type":"string"}},"required":["reachable","has_phone"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","contact_external_id","name","tag_ids"]},"ContactTagAssignmentSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/ContactWithTags"},"message":{"type":"string"}},"required":["success","data"]},"ContactCustomFieldCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"description":{"type":"string","minLength":1,"maxLength":500},"field_type":{"type":"string","enum":["text","number","boolean","date","select","multi_select"]},"validation":{"type":"object","properties":{"min_length":{"type":"integer","minimum":0,"maximum":2000},"max_length":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":2000},"pattern":{"type":"string","minLength":1,"maxLength":200},"pattern_message":{"type":"string","minLength":1,"maxLength":200},"min":{"type":"number"},"max":{"type":"number"},"integer_only":{"type":"boolean"}},"additionalProperties":false},"options":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"position":{"type":"integer","minimum":0,"maximum":10000}},"required":["name","field_type"],"additionalProperties":false},"ContactCustomFieldUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"description":{"nullable":true,"type":"string","minLength":1,"maxLength":500},"validation":{"nullable":true,"type":"object","properties":{"min_length":{"type":"integer","minimum":0,"maximum":2000},"max_length":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":2000},"pattern":{"type":"string","minLength":1,"maxLength":200},"pattern_message":{"type":"string","minLength":1,"maxLength":200},"min":{"type":"number"},"max":{"type":"number"},"integer_only":{"type":"boolean"}},"additionalProperties":false},"options":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"position":{"type":"integer","minimum":0,"maximum":10000}},"required":["name"],"additionalProperties":false},"ContactCustomFieldAssignmentInput":{"type":"object","properties":{"custom_fields":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["field_id","value"],"additionalProperties":false}}},"required":["custom_fields"]},"ContactCustomField":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"normalized_key":{"type":"string"},"description":{"type":"string"},"field_type":{"type":"string","enum":["text","number","boolean","date","select","multi_select"]},"validation":{"type":"object","properties":{"min_length":{"type":"integer","minimum":0,"maximum":2000},"max_length":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":2000},"pattern":{"type":"string","minLength":1,"maxLength":200},"pattern_message":{"type":"string","minLength":1,"maxLength":200},"min":{"type":"number"},"max":{"type":"number"},"integer_only":{"type":"boolean"}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"business_id":{"type":"string"}},"required":["_id","name","normalized_key","field_type","position","created_by","business_id"]},"ContactCustomFieldValue":{"type":"object","properties":{"definition":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"normalized_key":{"type":"string"},"description":{"type":"string"},"field_type":{"type":"string","enum":["text","number","boolean","date","select","multi_select"]},"validation":{"type":"object","properties":{"min_length":{"type":"integer","minimum":0,"maximum":2000},"max_length":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":2000},"pattern":{"type":"string","minLength":1,"maxLength":200},"pattern_message":{"type":"string","minLength":1,"maxLength":200},"min":{"type":"number"},"max":{"type":"number"},"integer_only":{"type":"boolean"}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"business_id":{"type":"string"}},"required":["_id","name","normalized_key","field_type","position","created_by","business_id"]},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["definition","value"]},"ContactCustomFieldSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/ContactCustomField"},"message":{"type":"string"}},"required":["success","data"]},"ContactCustomFieldListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ContactCustomField"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"ContactCustomFieldCollectionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ContactCustomFieldValue"}}},"required":["success","data"]},"ContactWithCustomFields":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"contact_external_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"phone_country_code":{"type":"string"},"document_type":{"type":"string"},"document_number":{"type":"string"},"payment_coupon_code":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}},"whatsapp":{"type":"object","properties":{"reachable":{"type":"boolean"},"has_phone":{"type":"boolean"},"username":{"type":"string"},"country_code":{"type":"string"}},"required":["reachable","has_phone"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"custom_fields":{"type":"array","items":{"type":"object","properties":{"field_id":{"type":"string"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["field_id","value"]}}},"required":["_id","business_id","contact_external_id","name","tag_ids","custom_fields"]},"ContactCustomFieldAssignmentSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/ContactWithCustomFields"},"message":{"type":"string"}},"required":["success","data"]},"Organization":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"name":{"type":"string"},"legal_name":{"type":"string"},"tax_id_type":{"type":"string"},"tax_id":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"website":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"metadata":{"type":"object","additionalProperties":{}},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","name","status","metadata","created_by"]},"OrganizationCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"legal_name":{"type":"string","minLength":1,"maxLength":240},"tax_id_type":{"type":"string","minLength":1,"maxLength":32},"tax_id":{"type":"string","minLength":1,"maxLength":64},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","minLength":6,"maxLength":32},"website":{"type":"string","maxLength":500,"format":"uri"},"status":{"type":"string","enum":["active","inactive"]},"metadata":{"type":"object","additionalProperties":{}}},"required":["name"]},"OrganizationUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"legal_name":{"type":"string","minLength":1,"maxLength":240},"tax_id_type":{"type":"string","minLength":1,"maxLength":32},"tax_id":{"type":"string","minLength":1,"maxLength":64},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","minLength":6,"maxLength":32},"website":{"type":"string","maxLength":500,"format":"uri"},"status":{"type":"string","enum":["active","inactive"]},"metadata":{"type":"object","additionalProperties":{}}}},"OrganizationSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/Organization"},"message":{"type":"string"}},"required":["success","data"]},"OrganizationListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Organization"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"PersonOrganizationRelationship":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"person_id":{"type":"string"},"organization_id":{"type":"string"},"relationship_type":{"type":"string"},"job_title":{"type":"string"},"valid_from":{"type":"string"},"valid_until":{"type":"string"},"metadata":{"type":"object","additionalProperties":{}},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","person_id","organization_id","relationship_type","metadata","created_by"]},"PersonOrganizationRelationshipInput":{"type":"object","properties":{"organization_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"relationship_type":{"type":"string","minLength":1,"maxLength":64},"job_title":{"type":"string","minLength":1,"maxLength":120},"valid_from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"valid_until":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"metadata":{"type":"object","additionalProperties":{}}},"required":["organization_id","relationship_type"]},"PersonOrganizationRelationshipSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/PersonOrganizationRelationship"},"message":{"type":"string"}},"required":["success","data"]},"PersonOrganizationRelationshipListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/PersonOrganizationRelationship"}}},"required":["success","data"]},"PartyProductRelationship":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"party_type":{"type":"string","enum":["person","organization"]},"person_id":{"type":"string"},"organization_id":{"type":"string"},"product_id":{"type":"string"},"product_name":{"type":"string"},"relationship_type":{"type":"string","enum":["interest","purchase","ownership","support"]},"source_type":{"type":"string","enum":["manual","case","order","support_case","import"]},"source_id":{"type":"string"},"metadata":{"type":"object","additionalProperties":{}},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","party_type","product_id","product_name","relationship_type","source_type","metadata","created_by"]},"PartyProductRelationshipInput":{"type":"object","properties":{"product_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"relationship_type":{"type":"string","enum":["interest","purchase","ownership","support"]},"source_type":{"type":"string","enum":["manual","case","order","support_case","import"]},"source_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"metadata":{"type":"object","additionalProperties":{}}},"required":["product_id","relationship_type"]},"PartyProductRelationshipSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/PartyProductRelationship"},"message":{"type":"string"}},"required":["success","data"]},"PartyProductRelationshipListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/PartyProductRelationship"}}},"required":["success","data"]},"AuditLog":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"visibility":{"type":"string","enum":["business","workspace"]},"actor_user_id":{"type":"string"},"actor_firebase_uid":{"type":"string"},"action":{"type":"string"},"resource_type":{"type":"string"},"resource_id":{"type":"string"},"metadata":{"type":"object","additionalProperties":{}},"occurred_at":{"type":"string"}},"required":["_id","business_id","visibility","actor_user_id","action","resource_type","resource_id","metadata","occurred_at"]},"AuditLogListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AuditLog"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"CaseTypeInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"icon":{"type":"string","minLength":1,"maxLength":50},"is_default":{"type":"boolean"}},"required":["name"],"additionalProperties":false},"CaseType":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"icon":{"type":"string"},"is_default":{"type":"boolean"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","is_default","created_by"]},"CaseTypeSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CaseType"}},"required":["success","data"]},"CaseLabelInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"}},"required":["name"],"additionalProperties":false},"CaseLabel":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","created_by"]},"CaseLabelSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CaseLabel"}},"required":["success","data"]},"CaseOutcomeReasonInput":{"type":"object","properties":{"code":{"type":"string","pattern":"^[a-z0-9][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":500},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"applies_to_outcomes":{"minItems":1,"maxItems":3,"type":"array","items":{"type":"string","enum":["negative","cancelled","neutral"]}},"position":{"type":"integer","minimum":0,"maximum":1000},"requires_note":{"type":"boolean"},"ai_guidance":{"type":"string","minLength":1,"maxLength":1000}},"required":["name","category","applies_to_outcomes","position"],"additionalProperties":false},"CaseOutcomeReason":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"applies_to_outcomes":{"type":"array","items":{"type":"string","enum":["negative","cancelled","neutral"]}},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"requires_note":{"type":"boolean"},"ai_guidance":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","code","name","category","applies_to_outcomes","position","requires_note","created_by"]},"CaseOutcomeReasonSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CaseOutcomeReason"}},"required":["success","data"]},"CaseOutcomeMetricsSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"definition":{"type":"object","properties":{"counting_unit":{"type":"string","enum":["terminal_transition"]},"date_field":{"type":"string","enum":["occurred_at"]},"reopen_policy":{"type":"string","enum":["each_terminal_transition_counts"]},"historical_unclassified_policy":{"type":"string","enum":["reported_not_inferred"]}},"required":["counting_unit","date_field","reopen_policy","historical_unclassified_policy"]},"period":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"timezone":{"type":"string","enum":["UTC"]}},"required":["timezone"]},"terminal_closures":{"type":"integer","minimum":0,"maximum":9007199254740991},"positive_closures":{"type":"integer","minimum":0,"maximum":9007199254740991},"non_positive_closures":{"type":"integer","minimum":0,"maximum":9007199254740991},"positive_rate":{"type":"number","minimum":0,"maximum":1},"non_positive_rate":{"type":"number","minimum":0,"maximum":1},"required_classified":{"type":"integer","minimum":0,"maximum":9007199254740991},"required_unclassified":{"type":"integer","minimum":0,"maximum":9007199254740991},"unclassified_rate":{"type":"number","minimum":0,"maximum":1},"outcomes":{"type":"array","items":{"type":"object","properties":{"outcome":{"type":"string","enum":["positive","negative","cancelled","neutral"]},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"rate":{"type":"number","minimum":0,"maximum":1}},"required":["outcome","count","rate"]}},"reasons":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"outcome":{"type":"string","enum":["negative","cancelled","neutral"]},"source":{"type":"string","enum":["manual","assistant","automation"]},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"share_of_outcome":{"type":"number","minimum":0,"maximum":1}},"required":["code","name","category","outcome","count","share_of_outcome"]}},"objections":{"type":"object","properties":{"counting_unit":{"type":"string","enum":["objection_occurrence"]},"date_field":{"type":"string","enum":["observed_at"]},"total_occurrences":{"type":"integer","minimum":0,"maximum":9007199254740991},"cases_with_objection":{"type":"integer","minimum":0,"maximum":9007199254740991},"terminal_cases":{"type":"integer","minimum":0,"maximum":9007199254740991},"incidence_rate":{"type":"number","minimum":0,"maximum":1},"resolved_occurrences":{"type":"integer","minimum":0,"maximum":9007199254740991},"unresolved_occurrences":{"type":"integer","minimum":0,"maximum":9007199254740991},"resolution_rate":{"type":"number","minimum":0,"maximum":1},"positive_converted_cases":{"type":"integer","minimum":0,"maximum":9007199254740991},"conversion_rate":{"type":"number","minimum":0,"maximum":1},"definitions":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"occurrences":{"type":"integer","minimum":0,"maximum":9007199254740991},"cases":{"type":"integer","minimum":0,"maximum":9007199254740991},"resolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"unresolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"positive_converted_cases":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","occurrences","cases","resolved","unresolved","positive_converted_cases"]}}},"required":["counting_unit","date_field","total_occurrences","cases_with_objection","terminal_cases","incidence_rate","resolved_occurrences","unresolved_occurrences","resolution_rate","positive_converted_cases","conversion_rate","definitions"]},"ai_suggestions":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"classified":{"type":"integer","minimum":0,"maximum":9007199254740991},"low_confidence":{"type":"integer","minimum":0,"maximum":9007199254740991},"unclassified":{"type":"integer","minimum":0,"maximum":9007199254740991},"pending":{"type":"integer","minimum":0,"maximum":9007199254740991},"accepted":{"type":"integer","minimum":0,"maximum":9007199254740991},"overridden":{"type":"integer","minimum":0,"maximum":9007199254740991},"rejected":{"type":"integer","minimum":0,"maximum":9007199254740991},"acceptance_rate":{"type":"number","minimum":0,"maximum":1},"override_rate":{"type":"number","minimum":0,"maximum":1},"rejection_rate":{"type":"number","minimum":0,"maximum":1}},"required":["total","classified","low_confidence","unclassified","pending","accepted","overridden","rejected","acceptance_rate","override_rate","rejection_rate"]}},"required":["definition","period","terminal_closures","positive_closures","non_positive_closures","positive_rate","non_positive_rate","required_classified","required_unclassified","unclassified_rate","outcomes","reasons","objections","ai_suggestions"]}},"required":["success","data"]},"CaseInsightRequest":{"type":"object","properties":{"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["idempotency_key"],"additionalProperties":false},"CaseObjectionCreateInput":{"type":"object","properties":{"definition_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"status":{"type":"string","enum":["observed","resolved","unresolved"]},"evidence_message_ids":{"maxItems":8,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["definition_id","idempotency_key"],"additionalProperties":false},"CaseObjectionReviewInput":{"type":"object","properties":{"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"review_action":{"type":"string","enum":["confirm","correct","discard"]},"definition_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"status":{"type":"string","enum":["observed","resolved","unresolved"]}},"required":["expected_version","review_action"],"additionalProperties":false},"CaseObjectionOccurrence":{"type":"object","properties":{"_id":{"type":"string"},"case_id":{"type":"string"},"conversation_id":{"type":"string"},"definition_id":{"type":"string"},"definition_snapshot":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"applies_to_outcomes":{"type":"array","items":{"type":"string","enum":["negative","cancelled","neutral"]}}},"required":["code","name","category","applies_to_outcomes"]},"status":{"type":"string","enum":["observed","resolved","unresolved"]},"review_status":{"type":"string","enum":["pending","confirmed","corrected","discarded"]},"source":{"type":"string","enum":["manual","assistant","automation"]},"confidence":{"type":"number","minimum":0,"maximum":1},"evidence_message_ids":{"type":"array","items":{"type":"string"}},"actor_user_id":{"type":"string"},"reviewed_by":{"type":"string"},"observed_at":{"type":"string"},"resolved_at":{"type":"string"},"reviewed_at":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","case_id","definition_id","definition_snapshot","status","review_status","source","evidence_message_ids","actor_user_id","observed_at","version"]},"CaseObjectionOccurrenceSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"case_id":{"type":"string"},"conversation_id":{"type":"string"},"definition_id":{"type":"string"},"definition_snapshot":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"applies_to_outcomes":{"type":"array","items":{"type":"string","enum":["negative","cancelled","neutral"]}}},"required":["code","name","category","applies_to_outcomes"]},"status":{"type":"string","enum":["observed","resolved","unresolved"]},"review_status":{"type":"string","enum":["pending","confirmed","corrected","discarded"]},"source":{"type":"string","enum":["manual","assistant","automation"]},"confidence":{"type":"number","minimum":0,"maximum":1},"evidence_message_ids":{"type":"array","items":{"type":"string"}},"actor_user_id":{"type":"string"},"reviewed_by":{"type":"string"},"observed_at":{"type":"string"},"resolved_at":{"type":"string"},"reviewed_at":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","case_id","definition_id","definition_snapshot","status","review_status","source","evidence_message_ids","actor_user_id","observed_at","version"]},"message":{"type":"string"}},"required":["success","data"]},"CaseObjectionOccurrenceListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"case_id":{"type":"string"},"conversation_id":{"type":"string"},"definition_id":{"type":"string"},"definition_snapshot":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"applies_to_outcomes":{"type":"array","items":{"type":"string","enum":["negative","cancelled","neutral"]}}},"required":["code","name","category","applies_to_outcomes"]},"status":{"type":"string","enum":["observed","resolved","unresolved"]},"review_status":{"type":"string","enum":["pending","confirmed","corrected","discarded"]},"source":{"type":"string","enum":["manual","assistant","automation"]},"confidence":{"type":"number","minimum":0,"maximum":1},"evidence_message_ids":{"type":"array","items":{"type":"string"}},"actor_user_id":{"type":"string"},"reviewed_by":{"type":"string"},"observed_at":{"type":"string"},"resolved_at":{"type":"string"},"reviewed_at":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","case_id","definition_id","definition_snapshot","status","review_status","source","evidence_message_ids","actor_user_id","observed_at","version"]}},"message":{"type":"string"}},"required":["success","data"]},"CaseOutcomeSuggestion":{"type":"object","properties":{"_id":{"type":"string"},"case_id":{"type":"string"},"conversation_id":{"type":"string"},"requested_by":{"type":"string"},"ai_run_id":{"type":"string"},"classification_status":{"type":"string","enum":["classified","low_confidence","unclassified"]},"decision_status":{"type":"string","enum":["pending","accepted","overridden","rejected"]},"candidates":{"type":"array","items":{"type":"object","properties":{"definition_id":{"type":"string"},"definition_snapshot":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"applies_to_outcomes":{"type":"array","items":{"type":"string","enum":["negative","cancelled","neutral"]}}},"required":["code","name","category","applies_to_outcomes"]},"confidence":{"type":"number","minimum":0,"maximum":1},"evidence_message_ids":{"type":"array","items":{"type":"string"}}},"required":["definition_id","definition_snapshot","confidence","evidence_message_ids"]}},"selected_definition_id":{"type":"string"},"decided_by":{"type":"string"},"decided_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","case_id","conversation_id","requested_by","classification_status","decision_status","candidates"]},"CaseOutcomeSuggestionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"case_id":{"type":"string"},"conversation_id":{"type":"string"},"requested_by":{"type":"string"},"ai_run_id":{"type":"string"},"classification_status":{"type":"string","enum":["classified","low_confidence","unclassified"]},"decision_status":{"type":"string","enum":["pending","accepted","overridden","rejected"]},"candidates":{"type":"array","items":{"type":"object","properties":{"definition_id":{"type":"string"},"definition_snapshot":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"applies_to_outcomes":{"type":"array","items":{"type":"string","enum":["negative","cancelled","neutral"]}}},"required":["code","name","category","applies_to_outcomes"]},"confidence":{"type":"number","minimum":0,"maximum":1},"evidence_message_ids":{"type":"array","items":{"type":"string"}}},"required":["definition_id","definition_snapshot","confidence","evidence_message_ids"]}},"selected_definition_id":{"type":"string"},"decided_by":{"type":"string"},"decided_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","case_id","conversation_id","requested_by","classification_status","decision_status","candidates"]},"message":{"type":"string"}},"required":["success","data"]},"CaseStateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"state_type":{"type":"string","enum":["open","terminal"]},"terminal_classification":{"type":"string","minLength":1,"maxLength":80},"terminal_outcome":{"type":"string","enum":["positive","negative","cancelled","neutral"]},"entry_action":{"type":"string","enum":["create_order"]},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"is_default":{"type":"boolean"}},"required":["name","position","state_type"],"additionalProperties":false},"CaseState":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"state_type":{"type":"string","enum":["open","terminal"]},"terminal_classification":{"type":"string","minLength":1,"maxLength":80},"terminal_outcome":{"type":"string","enum":["positive","negative","cancelled","neutral"]},"entry_action":{"type":"string","enum":["create_order"]},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"is_default":{"type":"boolean"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","position","state_type","is_default","created_by"]},"CaseStateSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CaseState"}},"required":["success","data"]},"CaseFunnelInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"state_ids":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"type_ids":{"maxItems":50,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"responsible_team_ids":{"maxItems":50,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"is_default":{"type":"boolean"}},"required":["name","state_ids"],"additionalProperties":false},"CaseFunnel":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"state_ids":{"type":"array","items":{"type":"string"}},"type_ids":{"type":"array","items":{"type":"string"}},"responsible_team_ids":{"type":"array","items":{"type":"string"}},"is_default":{"type":"boolean"},"states":{"type":"array","items":{"$ref":"#/components/schemas/CaseState"}},"types":{"type":"array","items":{"$ref":"#/components/schemas/CaseType"}},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","state_ids","type_ids","responsible_team_ids","is_default","states","types","created_by"]},"CaseFunnelSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CaseFunnel"}},"required":["success","data"]},"CaseConfigurationSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","required":["types","labels","states","outcome_reasons","funnels"],"properties":{"types":{"type":"array","items":{"$ref":"#/components/schemas/CaseType"}},"labels":{"type":"array","items":{"$ref":"#/components/schemas/CaseLabel"}},"states":{"type":"array","items":{"$ref":"#/components/schemas/CaseState"}},"outcome_reasons":{"type":"array","items":{"$ref":"#/components/schemas/CaseOutcomeReason"}},"funnels":{"type":"array","items":{"$ref":"#/components/schemas/CaseFunnel"}}}}},"required":["success","data"]},"CaseConfigurationArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}},"required":["success","data"]},"CaseCustomFieldCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"description":{"type":"string","minLength":1,"maxLength":500},"field_type":{"type":"string","enum":["text","number","boolean","date","select","multi_select"]},"validation":{"type":"object","properties":{"min_length":{"type":"integer","minimum":0,"maximum":2000},"max_length":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":2000},"pattern":{"type":"string","minLength":1,"maxLength":200},"pattern_message":{"type":"string","minLength":1,"maxLength":200},"min":{"type":"number"},"max":{"type":"number"},"integer_only":{"type":"boolean"}},"additionalProperties":false},"options":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"position":{"type":"integer","minimum":0,"maximum":10000},"source":{"type":"string","enum":["case","contact"]},"contact_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"applies_to_type_ids":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}},"required":["name","field_type"],"additionalProperties":false},"CaseCustomFieldUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"description":{"nullable":true,"type":"string","minLength":1,"maxLength":500},"validation":{"nullable":true,"type":"object","properties":{"min_length":{"type":"integer","minimum":0,"maximum":2000},"max_length":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":2000},"pattern":{"type":"string","minLength":1,"maxLength":200},"pattern_message":{"type":"string","minLength":1,"maxLength":200},"min":{"type":"number"},"max":{"type":"number"},"integer_only":{"type":"boolean"}},"additionalProperties":false},"options":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"position":{"type":"integer","minimum":0,"maximum":10000},"applies_to_type_ids":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}},"required":["name"],"additionalProperties":false},"CaseCustomFieldAssignmentInput":{"type":"object","properties":{"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"custom_fields":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["field_id","value"],"additionalProperties":false}}},"required":["expected_version","custom_fields"],"additionalProperties":false},"CaseCustomField":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"normalized_key":{"type":"string"},"description":{"type":"string"},"field_type":{"type":"string","enum":["text","number","boolean","date","select","multi_select"]},"validation":{"type":"object","properties":{"min_length":{"type":"integer","minimum":0,"maximum":2000},"max_length":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":2000},"pattern":{"type":"string","minLength":1,"maxLength":200},"pattern_message":{"type":"string","minLength":1,"maxLength":200},"min":{"type":"number"},"max":{"type":"number"},"integer_only":{"type":"boolean"}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"source":{"type":"string","enum":["case","contact"]},"contact_field_id":{"type":"string"},"applies_to_type_ids":{"type":"array","items":{"type":"string"}}},"required":["_id","name","normalized_key","field_type","position","created_by","business_id","workspace_id","source","applies_to_type_ids"]},"CaseCustomFieldValue":{"type":"object","properties":{"definition":{"$ref":"#/components/schemas/CaseCustomField"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["definition","value"]},"CaseCustomFieldSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CaseCustomField"},"message":{"type":"string"}},"required":["success","data"]},"CaseCustomFieldListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/CaseCustomField"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"CaseCustomFieldCollectionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/CaseCustomFieldValue"}}},"required":["success","data"]},"CaseCustomFieldArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]},"CaseReopenInput":{"type":"object","properties":{"to_state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["to_state_id","expected_version","idempotency_key"],"additionalProperties":false},"DialogEffect":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]},"AutomationEffect":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]},"DialogStep":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"type":{"type":"string","enum":["choice"]},"content":{"type":"string","minLength":1,"maxLength":1024},"header":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["image","video","document"]},"asset_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["type","asset_id"],"additionalProperties":false}]},"footer":{"type":"string","minLength":1,"maxLength":60},"options":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":20},"aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":80}},"effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"target_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","title","target_step_id"],"additionalProperties":false}}},"required":["id","type","content","options"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"header":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"],"additionalProperties":false},"type":{"type":"string","enum":["message"]},"content_source":{"type":"string","enum":["inline","template"]},"content":{"type":"string","minLength":1,"maxLength":4000},"template_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"media":{"oneOf":[{"type":"object","properties":{"source":{"type":"string","enum":["asset"]},"type":{"type":"string","enum":["image","video","document"]},"asset_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["source","type","asset_id"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","enum":["variable"]},"variable":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_.-]{0,199}$"}},"required":["source","variable"],"additionalProperties":false}]},"next_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","type","content_source"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"header":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"],"additionalProperties":false},"type":{"type":"string","enum":["form"]},"content":{"type":"string","minLength":1,"maxLength":4000},"fields":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":500},"data_type":{"type":"string","enum":["string","number","email","phone","date","boolean"]},"required":{"type":"boolean"},"required_when":{"type":"object","properties":{"field_key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"operator":{"type":"string","enum":["equals","not_equals"]},"value":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]}},"required":["field_key","operator","value"],"additionalProperties":false},"visible_when":{"type":"object","properties":{"field_key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"operator":{"type":"string","enum":["equals","not_equals"]},"value":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]}},"required":["field_key","operator","value"],"additionalProperties":false},"normalization":{"type":"string","enum":["trim","uppercase","digits_only","alphanumeric_upper"]},"validations":{"type":"object","properties":{"min_length":{"type":"integer","minimum":0,"maximum":4000},"max_length":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":4000},"pattern":{"type":"string","minLength":1,"maxLength":500},"min":{"type":"number"},"max":{"type":"number"},"validator":{"type":"string","enum":["pe.dni","pe.ruc","pe.ce","person.full_name"]},"error_message":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"options":{"oneOf":[{"type":"object","properties":{"source":{"type":"string","enum":["static"]},"items":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"value":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["value","label"],"additionalProperties":false}}},"required":["source","items"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","enum":["variable"]},"variable":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_.-]{0,199}$"},"value_field":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label_field":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"filters":{"default":[],"maxItems":5,"type":"array","items":{"type":"object","properties":{"field_key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"option_field":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["field_key","option_field"],"additionalProperties":false}}},"required":["source","variable","value_field","label_field"],"additionalProperties":false}]},"target":{"anyOf":[{"type":"object","properties":{"entity":{"type":"string","enum":["contact"]},"kind":{"type":"string","enum":["core"]},"field":{"type":"string"}},"required":["entity","kind","field"],"additionalProperties":false},{"type":"object","properties":{"entity":{"type":"string","enum":["contact"]},"kind":{"type":"string","enum":["custom"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["entity","kind","custom_field_id"],"additionalProperties":false},{"type":"object","properties":{"entity":{"type":"string","enum":["case"]},"kind":{"type":"string","enum":["core"]},"field":{"type":"string","enum":["title"]}},"required":["entity","kind","field"],"additionalProperties":false},{"type":"object","properties":{"entity":{"type":"string","enum":["case"]},"kind":{"type":"string","enum":["custom"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["entity","kind","custom_field_id"],"additionalProperties":false},{"type":"object","properties":{"entity":{"type":"string","enum":["session"]},"kind":{"type":"string","enum":["variable"]}},"required":["entity","kind"],"additionalProperties":false}]}},"required":["key","label","data_type","required","target"],"additionalProperties":false}},"confirmation_message":{"type":"string","minLength":1,"maxLength":4000},"max_attempts":{"default":5,"type":"integer","minimum":1,"maximum":20},"next_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"options_empty_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"options_failed_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"invalid_selection_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","type","content","fields","next_step_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"header":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"],"additionalProperties":false},"footer":{"type":"string","minLength":1,"maxLength":60},"type":{"type":"string","enum":["product_selection"]},"content":{"type":"string","minLength":1,"maxLength":4000},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"category_ids":{"default":[],"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"confirmed_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"declined_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","type","content","currency","confirmed_step_id","declined_step_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"header":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"],"additionalProperties":false},"footer":{"type":"string","minLength":1,"maxLength":60},"type":{"type":"string","enum":["calendar"]},"content":{"type":"string","minLength":1,"maxLength":4000},"calendar_binding_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"next_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","type","content","calendar_binding_id","next_step_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"header":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"],"additionalProperties":false},"type":{"type":"string","enum":["payment"]},"content":{"type":"string","minLength":1,"maxLength":4000},"amount_source":{"type":"string","enum":["fixed","product_selection_total","receivable","variable"]},"fixed_amount":{"type":"number","minimum":0,"exclusiveMinimum":true,"multipleOf":0.01},"amount_variable":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_.-]{0,199}$"},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"receivable_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"confirmation_template_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"confirmation_message":{"type":"string","minLength":1,"maxLength":4000},"next_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","type","content","amount_source"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"type":{"type":"string","enum":["decision"]},"source":{"type":"string","enum":["rules"]},"routes":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":50},"conditions":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"kind":{"type":"string","enum":["predicate"]},"field":{"type":"string","minLength":1,"maxLength":200},"operator":{"type":"string","enum":["equals","not_equals","contains","not_contains","greater_than","greater_than_or_equal","less_than","less_than_or_equal","in","not_in","length_equals","length_at_least","length_at_most","matches_regex","matches_validator","exists","not_exists"]},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"minItems":1,"maxItems":100,"type":"array","items":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}}]},"regex":{"type":"object","properties":{"match_mode":{"type":"string","enum":["partial","full"]},"flags":{"maxItems":3,"type":"array","items":{"type":"string","enum":["case_insensitive","multiline","dot_all"]}}},"required":["match_mode","flags"],"additionalProperties":false}},"required":["id","kind","field","operator"],"additionalProperties":false}},"target_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","label","conditions","target_step_id"],"additionalProperties":false}},"default_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"aggregates":{"default":[],"maxItems":5,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"source":{"type":"string","enum":["cases"]},"operation":{"type":"string","enum":["count"]},"variable":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_.-]{0,199}$"},"subject":{"type":"string","enum":["current_contact"]},"window":{"type":"object","properties":{"field":{"type":"string","enum":["created_at"]},"last_days":{"type":"integer","minimum":1,"maximum":365}},"required":["field","last_days"],"additionalProperties":false},"filters":{"type":"object","properties":{"type_ids":{"maxItems":10,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"state_ids":{"maxItems":10,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"label_ids":{"maxItems":10,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"categories":{"maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"statuses":{"maxItems":2,"type":"array","items":{"type":"string","enum":["open","closed"]}},"outcomes":{"maxItems":4,"type":"array","items":{"type":"string","enum":["positive","negative","cancelled","neutral"]}}},"additionalProperties":false}},"required":["id","source","operation","variable","subject","window"],"additionalProperties":false}}},"required":["id","type","routes","default_step_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"type":{"type":"string","enum":["decision"]},"source":{"type":"string","enum":["table"]},"decision_table_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"decision_table_version_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"decision_table_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"inputs":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"column_key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"source":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["variable"]},"field":{"type":"string","minLength":1,"maxLength":200}},"required":["kind","field"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["contact_core"]},"field":{"type":"string","enum":["name","email","phone","document_type","document_number","status","tag_ids"]}},"required":["kind","field"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["contact_custom"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["kind","custom_field_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["case_core"]},"field":{"type":"string","enum":["title","type_id","state_id","label_ids","priority","status","category","value","currency"]}},"required":["kind","field"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["case_custom"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["kind","custom_field_id"],"additionalProperties":false}]}},"required":["column_key","source"],"additionalProperties":false}},"outputs":{"default":[],"maxItems":20,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"data_type":{"type":"string","enum":["string","number","boolean","date","string_array"]}},"required":["output_key","data_type"],"additionalProperties":false}},"outcome_routes":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"outcome":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"target_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["outcome","target_step_id"],"additionalProperties":false}},"no_match_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"ambiguous_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"lookup_failed_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"aggregates":{"default":[],"maxItems":5,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"source":{"type":"string","enum":["cases"]},"operation":{"type":"string","enum":["count"]},"variable":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_.-]{0,199}$"},"subject":{"type":"string","enum":["current_contact"]},"window":{"type":"object","properties":{"field":{"type":"string","enum":["created_at"]},"last_days":{"type":"integer","minimum":1,"maximum":365}},"required":["field","last_days"],"additionalProperties":false},"filters":{"type":"object","properties":{"type_ids":{"maxItems":10,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"state_ids":{"maxItems":10,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"label_ids":{"maxItems":10,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"categories":{"maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"statuses":{"maxItems":2,"type":"array","items":{"type":"string","enum":["open","closed"]}},"outcomes":{"maxItems":4,"type":"array","items":{"type":"string","enum":["positive","negative","cancelled","neutral"]}}},"additionalProperties":false}},"required":["id","source","operation","variable","subject","window"],"additionalProperties":false}}},"required":["id","type","source","decision_table_id","inputs","outcome_routes","no_match_step_id","ambiguous_step_id","lookup_failed_step_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"header":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"],"additionalProperties":false},"type":{"type":"string","enum":["integration"]},"content":{"type":"string","minLength":1,"maxLength":4000},"operation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"operation_version_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"operation_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"inputs":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"input_key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"source":{"anyOf":[{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["variable"]},"field":{"type":"string","minLength":1,"maxLength":200}},"required":["kind","field"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["contact_core"]},"field":{"type":"string","enum":["name","email","phone","document_type","document_number","status","tag_ids"]}},"required":["kind","field"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["contact_custom"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["kind","custom_field_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["case_core"]},"field":{"type":"string","enum":["title","type_id","state_id","label_ids","priority","status","category","value","currency"]}},"required":["kind","field"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["case_custom"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["kind","custom_field_id"],"additionalProperties":false}]},{"type":"object","properties":{"kind":{"type":"string","enum":["literal"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{}},{"type":"object","additionalProperties":{}}]}},"required":["kind","value"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["system"]},"value":{"type":"string","enum":["current_datetime"]},"format":{"type":"string","enum":["iso_8601","date_iso","date_local","date_compact","local_datetime","unix_seconds","unix_milliseconds"]},"timezone":{"type":"string","minLength":1,"maxLength":100}},"required":["kind","value","format","timezone"],"additionalProperties":false}]}},"required":["input_key","source"],"additionalProperties":false}},"outputs":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"output_key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"variable":{"type":"string","minLength":1,"maxLength":200},"data_type":{"type":"string","enum":["string","number","boolean","date","array","object","artifact"]}},"required":["output_key","variable","data_type"],"additionalProperties":false}},"outcome_routes":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"outcome":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"target_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["outcome","target_step_id"],"additionalProperties":false}},"failed_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"timed_out_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"indeterminate_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","type","operation_id","inputs","outputs","outcome_routes","failed_step_id","timed_out_step_id","indeterminate_step_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"header":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"],"additionalProperties":false},"type":{"type":"string","enum":["human_handoff"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"content":{"type":"string","minLength":1,"maxLength":4000},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"intent_aliases":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"entry_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"exit_effects":{"default":[],"maxItems":50,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"type":{"type":"string","enum":["variable_assignment"]},"assignments":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"variable":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_.-]{0,199}$"},"data_type":{"type":"string","enum":["string","number","boolean","date"]},"operation":{"type":"string","enum":["set","concatenate","coalesce"]},"sources":{"minItems":1,"maxItems":10,"type":"array","items":{"anyOf":[{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["variable"]},"field":{"type":"string","minLength":1,"maxLength":200}},"required":["kind","field"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["contact_core"]},"field":{"type":"string","enum":["name","email","phone","document_type","document_number","status","tag_ids"]}},"required":["kind","field"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["contact_custom"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["kind","custom_field_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["case_core"]},"field":{"type":"string","enum":["title","type_id","state_id","label_ids","priority","status","category","value","currency"]}},"required":["kind","field"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["case_custom"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["kind","custom_field_id"],"additionalProperties":false}]},{"type":"object","properties":{"kind":{"type":"string","enum":["literal"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{}},{"type":"object","additionalProperties":{}}]}},"required":["kind","value"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["system"]},"value":{"type":"string","enum":["current_datetime"]},"format":{"type":"string","enum":["iso_8601","date_iso","date_local","date_compact","local_datetime","unix_seconds","unix_milliseconds"]},"timezone":{"type":"string","minLength":1,"maxLength":100}},"required":["kind","value","format","timezone"],"additionalProperties":false}]}},"separator":{"type":"string","maxLength":100}},"required":["id","variable","data_type","operation","sources"],"additionalProperties":false}},"next_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","type","assignments","next_step_id"],"additionalProperties":false}]},"DialogFlowDraft":{"type":"object","properties":{"schema_version":{"type":"number","enum":[1]},"entry_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"entry_intents":{"default":[],"maxItems":50,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"aliases":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"target_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","title","aliases","target_step_id"],"additionalProperties":false}},"steps":{"type":"array","maxItems":100,"items":{"$ref":"#/components/schemas/DialogStep"}},"visual_categories":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":80},"step_ids":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}}},"required":["id","label","step_ids"],"additionalProperties":false}}},"required":["schema_version","steps"],"additionalProperties":false},"DialogFlowCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"draft":{"$ref":"#/components/schemas/DialogFlowDraft"}},"required":["name","draft"],"additionalProperties":false},"DialogFlowDraftReplaceInput":{"type":"object","properties":{"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"draft":{"$ref":"#/components/schemas/DialogFlowDraft"}},"required":["expected_revision","name","draft"],"additionalProperties":false},"DialogFlowPublishInput":{"type":"object","properties":{"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["expected_revision"],"additionalProperties":false},"DialogFlowDesignInput":{"type":"object","properties":{"request_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"mode":{"type":"string","enum":["full_flow","continue_from_step","repair_flow"]},"prompt":{"type":"string","minLength":10,"maxLength":2000},"current_draft":{"$ref":"#/components/schemas/DialogFlowDraft"},"selected_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"connection":{"type":"string","enum":["next","choice_option","new_choice_option","confirmed","declined","form_options_empty","form_options_failed","form_invalid_selection","decision_route","decision_default","decision_no_match","decision_ambiguous","decision_lookup_failed","integration_outcome","integration_failed","integration_timed_out","integration_indeterminate"]},"connection_key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"choice_option_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"choice_option_title":{"type":"string","minLength":1,"maxLength":20}},"required":["request_id","mode","prompt","current_draft"],"additionalProperties":false},"DialogFlowDesignProposal":{"type":"object","properties":{"mode":{"type":"string","enum":["full_flow","continue_from_step","repair_flow"]},"summary":{"type":"string"},"draft":{"$ref":"#/components/schemas/DialogFlowDraft"},"added_step_ids":{"type":"array","items":{"type":"string"}},"changed_step_ids":{"type":"array","items":{"type":"string"}},"applicable":{"type":"boolean"},"requirements":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":80},"resource":{"type":"string","enum":["workspace_tool","contact_field","case_field","product_category","calendar_binding","template","integration_operation","decision_table","team","payment","flow"]},"message":{"type":"string","minLength":1,"maxLength":500},"action":{"type":"string","minLength":1,"maxLength":500},"step_id":{"nullable":true,"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["code","resource","message","action","step_id"],"additionalProperties":false}},"warnings":{"type":"array","items":{"type":"string"}},"validation_issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"},"step_id":{"nullable":true,"type":"string"}},"required":["path","message","step_id"]}},"ai_run_id":{"type":"string"}},"required":["mode","summary","draft","added_step_ids","changed_step_ids","applicable","requirements","warnings","validation_issues","ai_run_id"]},"DialogFlowDesignSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/DialogFlowDesignProposal"}},"required":["success","data"]},"DialogFlow":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"draft":{"$ref":"#/components/schemas/DialogFlowDraft"},"draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","draft","draft_revision","created_by","updated_by"]},"DialogFlowSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/DialogFlow"},"message":{"type":"string"}},"required":["success","data"]},"DialogFlowListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/DialogFlow"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"DialogFlowVersion":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"flow_id":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"schema_version":{"type":"number","enum":[1]},"name":{"type":"string"},"description":{"type":"string"},"entry_step_id":{"type":"string"},"entry_intents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"title":{"type":"string","minLength":1,"maxLength":100},"aliases":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"target_step_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","title","aliases","target_step_id"],"additionalProperties":false}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/DialogStep"}},"checksum":{"type":"string"},"source_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_by":{"type":"string"},"published_at":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","business_id","workspace_id","flow_id","version","schema_version","name","entry_step_id","entry_intents","steps","checksum","source_draft_revision","published_by","published_at"]},"DialogFlowVersionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/DialogFlowVersion"},"message":{"type":"string"}},"required":["success","data"]},"DialogFlowVersionListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/DialogFlowVersion"}}},"required":["success","data"]},"DialogFlowArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"flow_id":{"type":"string"}},"required":["flow_id"]},"message":{"type":"string"}},"required":["success","data","message"]},"DialogFlowAssetPrepareInput":{"type":"object","properties":{"type":{"type":"string","enum":["image","video","document"]},"content_type":{"type":"string","minLength":1,"maxLength":150},"filename":{"type":"string","minLength":1,"maxLength":255},"size_bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":104857600}},"required":["type","content_type","filename","size_bytes"],"additionalProperties":false},"DialogFlowAsset":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"flow_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"type":{"type":"string","enum":["image","video","document"]},"content_type":{"type":"string"},"filename":{"type":"string"},"size_bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"status":{"type":"string","enum":["pending","ready"]},"preview_url":{"type":"string"},"upload_expires_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"completed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","flow_id","type","content_type","filename","size_bytes","status","preview_url","upload_expires_at"]},"DialogFlowAssetPrepareSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"flow_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"type":{"type":"string","enum":["image","video","document"]},"content_type":{"type":"string"},"filename":{"type":"string"},"size_bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"status":{"type":"string","enum":["pending","ready"]},"preview_url":{"type":"string"},"upload_expires_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"completed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"upload_url":{"type":"string","format":"uri"},"upload_method":{"type":"string","enum":["PUT","POST"]},"upload_headers":{"type":"object","additionalProperties":{"type":"string"}}},"required":["_id","flow_id","type","content_type","filename","size_bytes","status","preview_url","upload_expires_at","upload_url","upload_method","upload_headers"]}},"required":["success","data"]},"DialogFlowAssetSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"flow_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"type":{"type":"string","enum":["image","video","document"]},"content_type":{"type":"string"},"filename":{"type":"string"},"size_bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"status":{"type":"string","enum":["pending","ready"]},"preview_url":{"type":"string"},"upload_expires_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"completed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","flow_id","type","content_type","filename","size_bytes","status","preview_url","upload_expires_at"]}},"required":["success","data"]},"DialogFlowValidationError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"code":{"type":"string","enum":["FLOW_INVALID","CAPABILITY_UNAVAILABLE","DRAFT_REVISION_CONFLICT"]},"error":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"},"step_id":{"type":"string"}},"required":["path","message"]}}},"required":["success","error","issues"]},"DialogFlowDesignError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"code":{"type":"string","enum":["AI_PROVIDER_NOT_CONFIGURED","AI_PROVIDER_UNAVAILABLE","AI_MODEL_UNAVAILABLE","AI_TIMEOUT","AI_RATE_LIMITED","AI_LIMIT_EXCEEDED","AI_NETWORK_ERROR","AI_OUTPUT_INVALID","AI_PROPOSAL_INVALID"]},"error":{"type":"string"},"ai_run_id":{"type":"string"},"retryable":{"type":"boolean"}},"required":["success","code","error","retryable"]},"DecisionTableInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"draft":{"type":"object","properties":{"columns":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"data_type":{"type":"string","enum":["string","number","boolean","date","string_array"]},"match_type":{"type":"string","enum":["equals","contains","range"]},"normalization":{"type":"string","enum":["exact","trim","case_insensitive","lowercase","uppercase","digits_only","alphanumeric_upper"]},"default_value":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":2000}}]}},"required":["key","label","data_type","match_type"],"additionalProperties":false}},"outputs":{"default":[],"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"data_type":{"type":"string","enum":["string","number","boolean","date","string_array"]}},"required":["key","label","data_type"],"additionalProperties":false}},"outcomes":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"rows":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"priority":{"type":"integer","minimum":0,"maximum":10000},"cells":{"type":"object","additionalProperties":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"object","properties":{"min":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"number"}]},"max":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"number"}]}},"additionalProperties":false}]}},"values":{"default":{},"type":"object","additionalProperties":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":2000}}]}},"outcome":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"reason_code":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","priority","cells","outcome"],"additionalProperties":false}}},"required":["columns","outcomes","rows"],"additionalProperties":false}},"required":["name","draft"],"additionalProperties":false},"DecisionTableDraftReplaceInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"draft":{"type":"object","properties":{"columns":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"data_type":{"type":"string","enum":["string","number","boolean","date","string_array"]},"match_type":{"type":"string","enum":["equals","contains","range"]},"normalization":{"type":"string","enum":["exact","trim","case_insensitive","lowercase","uppercase","digits_only","alphanumeric_upper"]},"default_value":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":2000}}]}},"required":["key","label","data_type","match_type"],"additionalProperties":false}},"outputs":{"default":[],"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"data_type":{"type":"string","enum":["string","number","boolean","date","string_array"]}},"required":["key","label","data_type"],"additionalProperties":false}},"outcomes":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"rows":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"priority":{"type":"integer","minimum":0,"maximum":10000},"cells":{"type":"object","additionalProperties":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"object","properties":{"min":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"number"}]},"max":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"number"}]}},"additionalProperties":false}]}},"values":{"default":{},"type":"object","additionalProperties":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":2000}}]}},"outcome":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"reason_code":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","priority","cells","outcome"],"additionalProperties":false}}},"required":["columns","outcomes","rows"],"additionalProperties":false},"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["name","draft","expected_revision"],"additionalProperties":false},"DecisionTablePublishInput":{"type":"object","properties":{"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["expected_revision"],"additionalProperties":false},"DecisionTable":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string"},"description":{"type":"string"},"draft":{"type":"object","properties":{"columns":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"data_type":{"type":"string","enum":["string","number","boolean","date","string_array"]},"match_type":{"type":"string","enum":["equals","contains","range"]},"normalization":{"type":"string","enum":["exact","trim","case_insensitive","lowercase","uppercase","digits_only","alphanumeric_upper"]},"default_value":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":2000}}]}},"required":["key","label","data_type","match_type"],"additionalProperties":false}},"outputs":{"default":[],"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"data_type":{"type":"string","enum":["string","number","boolean","date","string_array"]}},"required":["key","label","data_type"],"additionalProperties":false}},"outcomes":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"rows":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"priority":{"type":"integer","minimum":0,"maximum":10000},"cells":{"type":"object","additionalProperties":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"object","properties":{"min":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"number"}]},"max":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"number"}]}},"additionalProperties":false}]}},"values":{"default":{},"type":"object","additionalProperties":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":2000}}]}},"outcome":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"reason_code":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","priority","cells","outcome"],"additionalProperties":false}}},"required":["columns","outcomes","rows"],"additionalProperties":false},"draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"updated_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","name","draft","draft_revision","created_by","updated_by"]},"DecisionTableSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DecisionTable"}},"required":["success","data"]},"DecisionTableListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DecisionTable"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"DecisionTableVersion":{"type":"object","properties":{"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"business_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"table_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"name":{"type":"string"},"description":{"type":"string"},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"data_type":{"type":"string","enum":["string","number","boolean","date","string_array"]},"match_type":{"type":"string","enum":["equals","contains","range"]},"normalization":{"type":"string","enum":["exact","trim","case_insensitive","lowercase","uppercase","digits_only","alphanumeric_upper"]},"default_value":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":2000}}]}},"required":["key","label","data_type","match_type"],"additionalProperties":false}},"outputs":{"default":[],"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"data_type":{"type":"string","enum":["string","number","boolean","date","string_array"]}},"required":["key","label","data_type"],"additionalProperties":false}},"outcomes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":100}},"required":["key","label"],"additionalProperties":false}},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"priority":{"type":"integer","minimum":0,"maximum":10000},"cells":{"type":"object","additionalProperties":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"type":"object","properties":{"min":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"number"}]},"max":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"number"}]}},"additionalProperties":false}]}},"values":{"default":{},"type":"object","additionalProperties":{"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"number"},{"type":"boolean"},{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":2000}}]}},"outcome":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"reason_code":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"}},"required":["id","priority","cells","outcome"],"additionalProperties":false}},"checksum":{"type":"string"},"source_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_by":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"published_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["_id","business_id","workspace_id","table_id","version","name","columns","outcomes","rows","checksum","source_draft_revision","published_by","published_at"]},"DecisionTableVersionSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DecisionTableVersion"}},"required":["success","data"]},"DecisionTableVersionListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DecisionTableVersion"}}},"required":["success","data"]},"DecisionTableValidationIssue":{"type":"object","required":["path","message"],"properties":{"path":{"type":"string"},"message":{"type":"string"}}},"DecisionTableValidationError":{"type":"object","required":["success","error","issues"],"properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string"},"issues":{"type":"array","items":{"$ref":"#/components/schemas/DecisionTableValidationIssue"}}}},"KnowledgeSourceInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["faq","location","document"]},"draft":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":500},"aliases":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":160}},"content":{"type":"string","maxLength":50000}},"required":["title","content"],"additionalProperties":false}},"required":["name","type","draft"],"additionalProperties":false},"KnowledgeSourceDraftReplaceInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["faq","location","document"]},"draft":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":500},"aliases":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":160}},"content":{"type":"string","maxLength":50000}},"required":["title","content"],"additionalProperties":false},"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["name","type","draft","expected_revision"],"additionalProperties":false},"KnowledgeSourcePublishInput":{"type":"object","properties":{"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["expected_revision"],"additionalProperties":false},"KnowledgeSource":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["faq","location","document"]},"origin":{"type":"string","enum":["manual","assistant_ai"]},"origin_gap_id":{"type":"string"},"draft":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":500},"aliases":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":160}},"content":{"type":"string","maxLength":50000}},"required":["title","content"],"additionalProperties":false},"draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","type","origin","draft","draft_revision","created_by","updated_by"]},"KnowledgeSourceSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/KnowledgeSource"}},"required":["success","data"]},"KnowledgeSourceListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeSource"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"KnowledgeSourceVersion":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"source_id":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"type":{"type":"string","enum":["faq","location","document"]},"name":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"aliases":{"type":"array","items":{"type":"string"}},"content":{"type":"string"},"checksum":{"type":"string"},"source_draft_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"published_by":{"type":"string"},"published_at":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","business_id","workspace_id","source_id","version","type","name","title","aliases","content","checksum","source_draft_revision","published_by","published_at"]},"KnowledgeSourceVersionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/KnowledgeSourceVersion"}},"required":["success","data"]},"KnowledgeSourceVersionListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeSourceVersion"}}},"required":["success","data"]},"KnowledgeGap":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"assistant_id":{"type":"string"},"flow_id":{"type":"string"},"flow_version_id":{"type":"string"},"step_id":{"type":"string"},"capability":{"type":"string","enum":["general","knowledge_base","products","orders"]},"question":{"type":"string"},"status":{"type":"string","enum":["suggested","resolved","dismissed"]},"origin":{"type":"string","enum":["assistant_ai"]},"occurrences":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"first_seen_at":{"type":"string"},"last_seen_at":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"resolution_note":{"type":"string"},"resolved_source_id":{"type":"string"},"reviewed_by":{"type":"string"},"reviewed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","assistant_id","flow_id","flow_version_id","step_id","capability","question","status","origin","occurrences","first_seen_at","last_seen_at","version"]},"KnowledgeGapSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/KnowledgeGap"},"message":{"type":"string"}},"required":["success","data"]},"KnowledgeGapListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeGap"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"KnowledgeGapReviewInput":{"type":"object","properties":{"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"note":{"type":"string","maxLength":500}},"required":["expected_version"],"additionalProperties":false},"KnowledgeGapResolveInput":{"type":"object","properties":{"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"note":{"type":"string","maxLength":500},"source_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["expected_version","source_id"],"additionalProperties":false},"KnowledgeGapConvertInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["faq","location","document"]},"draft":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":500},"aliases":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":160}},"content":{"type":"string","maxLength":50000}},"required":["title","content"],"additionalProperties":false},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["name","type","draft","expected_version"],"additionalProperties":false},"KnowledgeGapConvertSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"gap":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"assistant_id":{"type":"string"},"flow_id":{"type":"string"},"flow_version_id":{"type":"string"},"step_id":{"type":"string"},"capability":{"type":"string","enum":["general","knowledge_base","products","orders"]},"question":{"type":"string"},"status":{"type":"string","enum":["suggested","resolved","dismissed"]},"origin":{"type":"string","enum":["assistant_ai"]},"occurrences":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"first_seen_at":{"type":"string"},"last_seen_at":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"resolution_note":{"type":"string"},"resolved_source_id":{"type":"string"},"reviewed_by":{"type":"string"},"reviewed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","assistant_id","flow_id","flow_version_id","step_id","capability","question","status","origin","occurrences","first_seen_at","last_seen_at","version"]},"source_id":{"type":"string"}},"required":["gap","source_id"]},"message":{"type":"string"}},"required":["success","data"]},"AssistantPolicies":{"type":"object","properties":{"routing_fallback":{"default":"reprompt","type":"string","enum":["reprompt","handoff"]}},"additionalProperties":false},"AssistantLateralQuestions":{"type":"object","properties":{"enabled":{"type":"boolean"},"register_gaps":{"type":"boolean"},"products":{"type":"object","properties":{"permissions":{"maxItems":3,"type":"array","items":{"type":"string","enum":["prices","stock","ticket_selection"]}},"category_ids":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}},"required":["permissions","category_ids"],"additionalProperties":false},"orders":{"type":"object","properties":{"permissions":{"minItems":1,"maxItems":1,"type":"array","items":{"type":"string","enum":["status"]}}},"required":["permissions"],"additionalProperties":false}},"required":["enabled","register_gaps"],"additionalProperties":false},"AssistantDefinitionCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"status":{"type":"string","enum":["active","inactive"]},"policies":{"$ref":"#/components/schemas/AssistantPolicies"},"lateral_questions":{"$ref":"#/components/schemas/AssistantLateralQuestions"},"default_flow_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"knowledge_source_ids":{"default":[],"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}},"required":["name","status","policies","default_flow_id"],"additionalProperties":false},"AssistantDefinitionUpdateInput":{"type":"object","properties":{"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"status":{"type":"string","enum":["active","inactive"]},"policies":{"$ref":"#/components/schemas/AssistantPolicies"},"lateral_questions":{"$ref":"#/components/schemas/AssistantLateralQuestions"},"default_flow_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"knowledge_source_ids":{"default":[],"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}},"required":["expected_version","name","status","policies","lateral_questions","default_flow_id"],"additionalProperties":false},"AssistantDefinition":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"policies":{"$ref":"#/components/schemas/AssistantPolicies"},"lateral_questions":{"$ref":"#/components/schemas/AssistantLateralQuestions"},"default_flow_id":{"type":"string"},"knowledge_source_ids":{"type":"array","items":{"type":"string"}},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","status","policies","lateral_questions","default_flow_id","knowledge_source_ids","version","created_by","updated_by"]},"AssistantDefinitionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/AssistantDefinition"},"message":{"type":"string"}},"required":["success","data"]},"AssistantDefinitionListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AssistantDefinition"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"AssistantChannelBindingInput":{"type":"object","properties":{"assistant_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["assistant_id"],"additionalProperties":false},"AssistantChannelBinding":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"workspace_channel_id":{"type":"string"},"assistant_id":{"type":"string"},"bound_by":{"type":"string"},"bound_at":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","business_id","workspace_id","workspace_channel_id","assistant_id","bound_by","bound_at"]},"AssistantChannelBindingSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/AssistantChannelBinding"},"message":{"type":"string"}},"required":["success","data"]},"AssistantChannelBindingListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AssistantChannelBinding"}}},"required":["success","data"]},"AssistantChannelBindingDeleteSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"workspace_channel_id":{"type":"string"}},"required":["workspace_channel_id"]},"message":{"type":"string"}},"required":["success","data","message"]},"AssistantSessionControlInput":{"default":{},"type":"object","properties":{"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"additionalProperties":false},"AssistantSessionHandoffInput":{"type":"object","properties":{"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"reason":{"type":"string","minLength":3,"maxLength":500}},"required":["expected_version","reason"],"additionalProperties":false},"ConversationAssistantSession":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"conversation_id":{"type":"string"},"assistant_id":{"type":"string"},"flow_id":{"type":"string"},"flow_version_id":{"type":"string"},"current_step_id":{"type":"string"},"status":{"type":"string","enum":["active","waiting_input","waiting_external","paused","handed_off","completed","failed"]},"control_mode":{"type":"string","enum":["assistant","human"]},"control_epoch":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"activity":{"type":"object","properties":{"status":{"type":"string","enum":["idle","queued","processing","retrying","failed"]},"run_id":{"type":"string"},"inbound_message_id":{"type":"string"},"attempt":{"type":"integer","minimum":0,"maximum":9007199254740991},"max_attempts":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"started_at":{"type":"string"},"updated_at":{"type":"string"},"lease_expires_at":{"type":"string"},"error_code":{"type":"string"},"retryable":{"type":"boolean"},"failed_at":{"type":"string"}},"required":["status","attempt","max_attempts","updated_at"]},"paused_from_status":{"type":"string","enum":["active","waiting_input","waiting_external","paused","handed_off","completed","failed"]},"step_state":{"type":"object","additionalProperties":{}},"variables":{"type":"object","additionalProperties":{}},"last_processed_message_id":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"started_at":{"type":"string"},"paused_at":{"type":"string"},"resumed_at":{"type":"string"},"completed_at":{"type":"string"},"failed_at":{"type":"string"},"last_controlled_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","conversation_id","assistant_id","flow_id","flow_version_id","current_step_id","status","control_mode","control_epoch","activity","step_state","variables","version","started_at"]},"ConversationAssistantSessionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/ConversationAssistantSession"},"message":{"type":"string"}},"required":["success","data"]},"AssistantSimulationInput":{"type":"object","properties":{"simulation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"inputs":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","interactive"]},"text":{"type":"string","minLength":1,"maxLength":4000},"interactive_payload":{"type":"string","minLength":1,"maxLength":256}},"required":["type"],"additionalProperties":false}}},"required":["inputs"],"additionalProperties":false},"AssistantSimulationSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"simulation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"flow_version_id":{"type":"string"},"final_step_id":{"type":"string"},"status":{"type":"string","enum":["completed","waiting_input","failed"]},"ai":{"type":"object","properties":{"enabled":{"type":"boolean","enum":[true]},"used":{"type":"boolean"},"fallback":{"type":"boolean"},"profile":{"type":"string","enum":["assistant"]},"assistant_id":{"type":"string"}},"required":["enabled","used","fallback","profile","assistant_id"]},"traces":{"type":"array","items":{"type":"object","properties":{"input_sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"input":{"type":"object","properties":{"type":{"type":"string","enum":["text","interactive"]},"text":{"type":"string","minLength":1,"maxLength":4000},"interactive_payload":{"type":"string","minLength":1,"maxLength":256}},"required":["type"],"additionalProperties":false},"execution":{"type":"object","properties":{"current_step_id":{"type":"string"},"session_status":{"type":"string","enum":["active","waiting_input","waiting_external","paused","handed_off","completed","failed"]},"run_status":{"type":"string","enum":["completed","waiting_input","failed"]},"trace":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"step_id":{"type":"string"},"step_type":{"type":"string","enum":["choice","message","form","product_selection","calendar","payment","variable_assignment","decision","integration","human_handoff"]},"action":{"type":"string","enum":["prompted","matched","emitted","collected","confirmed","cancelled","routed","answered_lateral","fallback","handed_off","evaluated","branched","requested","resumed","transitioned","completed","failed","assigned"]},"matched_option_id":{"type":"string"},"matched_intent_id":{"type":"string"},"knowledge_source_id":{"type":"string"},"knowledge_source_version_id":{"type":"string"},"knowledge_source_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"target_step_id":{"type":"string"},"produced_message_sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"error_code":{"type":"string"},"condition_id":{"type":"string"},"condition_result":{"type":"boolean"},"decision_route_id":{"type":"string"},"decision_table_id":{"type":"string"},"decision_table_version_id":{"type":"string"},"decision_table_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"decision_table_row_id":{"type":"string"},"decision_table_outcome":{"type":"string"},"decision_table_reason_code":{"type":"string"},"decision_table_failure_reason":{"type":"string","enum":["invalid_reference","table_unavailable","timeout"]},"decision_table_output_keys":{"type":"array","items":{"type":"string"}},"variable_assignment_keys":{"type":"array","items":{"type":"string"}},"integration_operation_id":{"type":"string"},"integration_operation_version_id":{"type":"string"},"integration_operation_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"integration_invocation_id":{"type":"string"},"integration_status":{"type":"string","enum":["queued","succeeded","failed","timed_out","indeterminate"]},"integration_outcome":{"type":"string"}},"required":["sequence","step_id","step_type","action"]}},"messages":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"kind":{"type":"string","enum":["text","choice","image"]},"text":{"type":"string"},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"}},"required":["id","title"]}},"header":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["image","video","document"]},"asset_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["type","asset_id"],"additionalProperties":false}]},"mediaUrl":{"type":"string","format":"uri"},"mediaContentType":{"type":"string"},"artifactId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"dialogAsset":{"type":"object","properties":{"source":{"type":"string","enum":["asset"]},"type":{"type":"string","enum":["image","video","document"]},"asset_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["source","type","asset_id"],"additionalProperties":false}},"required":["sequence","kind","text"]}},"effects":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"step_id":{"type":"string"},"transition_id":{"type":"string"},"effect":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]}},"required":["sequence","step_id","transition_id","effect"]}},"error_code":{"type":"string"},"error_message":{"type":"string"}},"required":["current_step_id","session_status","run_status","trace","messages","effects"]}},"required":["input_sequence","input","execution"]}}},"required":["simulation_id","flow_version_id","final_step_id","status","ai","traces"]}},"required":["success","data"]},"AssistantAiUsageQuery":{"type":"object","properties":{"assistant_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"additionalProperties":false},"AssistantAiUsageSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"business_id":{"type":"string"},"workspace_id":{"type":"string"},"assistant_id":{"type":"string"},"conversation_id":{"type":"string"},"runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"successful_runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"fallback_runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"input_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"cached_input_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"output_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"reasoning_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"total_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"tool_calls":{"type":"integer","minimum":0,"maximum":9007199254740991},"total_latency_ms":{"type":"number","minimum":0},"average_latency_ms":{"type":"number","minimum":0},"estimated_cost_microusd":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["business_id","workspace_id","runs","successful_runs","fallback_runs","input_tokens","cached_input_tokens","output_tokens","reasoning_tokens","total_tokens","tool_calls","total_latency_ms","average_latency_ms","estimated_cost_microusd"]}},"required":["success","data"]},"EffectRun":{"type":"object","properties":{"_id":{"type":"string"},"batch_id":{"type":"string"},"sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"idempotency_key":{"type":"string"},"effect_id":{"type":"string"},"effect_type":{"type":"string"},"effect_version":{"type":"integer","minimum":1,"maximum":1},"failure_policy":{"type":"string","enum":["stop","continue"]},"payload":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]},"targets":{"type":"object","properties":{"conversation_id":{"type":"string"},"contact_id":{"type":"string"},"case_id":{"type":"string"},"order_id":{"type":"string"},"assistant_session_id":{"type":"string"}},"required":["conversation_id","contact_id","assistant_session_id"]},"source":{"type":"object","properties":{"kind":{"type":"string","enum":["assistant"]},"flow_version_id":{"type":"string"},"step_id":{"type":"string"},"transition_id":{"type":"string"}},"required":["kind","flow_version_id","step_id","transition_id"]},"status":{"type":"string","enum":["running","success","skipped","failed","retry"]},"attempts":{"type":"integer","minimum":0,"maximum":9007199254740991},"result":{"type":"object","additionalProperties":{}},"error_code":{"type":"string"},"error_message":{"type":"string"},"retryable":{"type":"boolean"},"started_at":{"type":"string"},"completed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","batch_id","sequence","idempotency_key","effect_id","effect_type","effect_version","failure_policy","payload","targets","source","status","attempts","started_at"]},"EffectRunListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/EffectRun"}}},"required":["success","data"]},"EffectCatalogSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"version":{"type":"integer","minimum":1,"maximum":9007199254740991},"permission":{"type":"string"},"capability":{"type":"string"},"required_targets":{"type":"array","items":{"type":"string","enum":["conversation_id","contact_id","case_id","order_id","assistant_session_id"]}}},"required":["type","version","permission","capability","required_targets"]}}},"required":["success","data"]},"AutomationCondition":{"oneOf":[{"type":"object","additionalProperties":false,"required":["kind","field","operator"],"properties":{"kind":{"type":"string","enum":["predicate"]},"field":{"type":"string"},"operator":{"type":"string","enum":["equals","not_equals","in","not_in","exists","not_exists","contains","greater_than","greater_than_or_equal","less_than","less_than_or_equal"]},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{}}],"nullable":true}}},{"type":"object","additionalProperties":false,"required":["kind","operator","conditions"],"properties":{"kind":{"type":"string","enum":["group"]},"operator":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","minItems":1,"maxItems":50,"items":{"$ref":"#/components/schemas/AutomationCondition"}}}}]},"AutomationDraft":{"type":"object","additionalProperties":false,"required":["schema_version","actions"],"properties":{"schema_version":{"type":"integer","enum":[1]},"trigger":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["domain_event","schedule","at"]},"event_type":{"type":"string"},"schedule":{"type":"string","description":"Cron de cinco campos."},"at":{"type":"string","format":"date-time"},"timezone":{"type":"string","description":"Timezone IANA explícita."},"catch_up_window_minutes":{"type":"integer","minimum":1,"maximum":43200,"default":1440},"targets":{"type":"object","additionalProperties":false,"properties":{"conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"case_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"assistant_session_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}}}},"conditions":{"$ref":"#/components/schemas/AutomationCondition"},"exit":{"type":"object","additionalProperties":false,"required":["event_type"],"properties":{"event_type":{"type":"string"},"conditions":{"$ref":"#/components/schemas/AutomationCondition"}}},"limits":{"type":"object","additionalProperties":false,"required":["max_occurrences"],"properties":{"max_occurrences":{"type":"integer","minimum":1,"maximum":10000}}},"actions":{"type":"array","maxItems":50,"items":{"$ref":"#/components/schemas/AutomationEffect"}}}},"AutomationCreateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"draft":{"$ref":"#/components/schemas/AutomationDraft"}},"required":["name","draft"],"additionalProperties":false},"AutomationUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"draft":{"$ref":"#/components/schemas/AutomationDraft"},"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["name","draft","expected_revision"],"additionalProperties":false},"AutomationStatusInput":{"type":"object","properties":{"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["expected_revision"],"additionalProperties":false},"AutomationDefinition":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["draft","active","paused","completed"]},"draft":{"$ref":"#/components/schemas/AutomationDraft"},"revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"activated_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"activated_at":{"type":"string"},"activated_by":{"type":"string"},"paused_at":{"type":"string"},"paused_by":{"type":"string"},"next_due_at":{"type":"string"},"last_materialized_at":{"type":"string"},"schedule_skipped_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"schedule_materialized_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"completion_reason":{"type":"string","enum":["exit_condition","limit_reached"]},"completed_at":{"type":"string"},"source_type":{"type":"string","enum":["studio_ai"]},"source_id":{"type":"string"},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","status","draft","revision","created_by","updated_by"]},"AutomationSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/AutomationDefinition"},"message":{"type":"string"}},"required":["success","data"]},"AutomationListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AutomationDefinition"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"AutomationArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"automation_id":{"type":"string"}},"required":["automation_id"]},"message":{"type":"string"}},"required":["success","data"]},"AutomationValidationError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]}}},"required":["success","error","issues"]},"AutomationRun":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"decision_id":{"type":"string"},"definition_id":{"type":"string"},"definition_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"definition_name":{"type":"string"},"source_event_id":{"type":"string"},"source_event_type":{"type":"string"},"effect_batch_id":{"type":"string"},"status":{"type":"string","enum":["running","succeeded","failed","poisoned"]},"action_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"manual_retry_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_manual_retry_at":{"type":"string"},"last_manual_retry_by":{"type":"string"},"summary":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeeded":{"type":"integer","minimum":0,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":0,"maximum":9007199254740991},"failed":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["total","succeeded","skipped","failed"]},"started_at":{"type":"string"},"completed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","decision_id","definition_id","definition_revision","definition_name","source_event_id","source_event_type","effect_batch_id","status","action_count","started_at"]},"AutomationActionRun":{"type":"object","properties":{"_id":{"type":"string"},"batch_id":{"type":"string"},"sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"idempotency_key":{"type":"string"},"effect_id":{"type":"string"},"effect_type":{"type":"string"},"effect_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"failure_policy":{"type":"string","enum":["stop","continue"]},"payload":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]},"targets":{"type":"object","properties":{"conversation_id":{"type":"string"},"contact_id":{"type":"string"},"case_id":{"type":"string"},"order_id":{"type":"string"},"assistant_session_id":{"type":"string"},"user_id":{"type":"string"}}},"source":{"type":"object","properties":{"kind":{"type":"string","enum":["automation"]},"automation_run_id":{"type":"string"},"definition_id":{"type":"string"},"decision_id":{"type":"string"},"source_event_id":{"type":"string"}},"required":["kind","automation_run_id","definition_id","decision_id","source_event_id"]},"status":{"type":"string","enum":["running","success","skipped","failed","retry"]},"attempts":{"type":"integer","minimum":0,"maximum":9007199254740991},"result":{"type":"object","additionalProperties":{}},"error_code":{"type":"string"},"error_message":{"type":"string"},"retryable":{"type":"boolean"},"manual_retry_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"started_at":{"type":"string"},"completed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","batch_id","sequence","idempotency_key","effect_id","effect_type","effect_version","failure_policy","payload","targets","source","status","attempts","started_at"]},"AutomationRunListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AutomationRun"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"AutomationRunDetailSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"run":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"decision_id":{"type":"string"},"definition_id":{"type":"string"},"definition_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"definition_name":{"type":"string"},"source_event_id":{"type":"string"},"source_event_type":{"type":"string"},"effect_batch_id":{"type":"string"},"status":{"type":"string","enum":["running","succeeded","failed","poisoned"]},"action_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"manual_retry_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_manual_retry_at":{"type":"string"},"last_manual_retry_by":{"type":"string"},"summary":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeeded":{"type":"integer","minimum":0,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":0,"maximum":9007199254740991},"failed":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["total","succeeded","skipped","failed"]},"started_at":{"type":"string"},"completed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","decision_id","definition_id","definition_revision","definition_name","source_event_id","source_event_type","effect_batch_id","status","action_count","started_at"]},"actions":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"batch_id":{"type":"string"},"sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"idempotency_key":{"type":"string"},"effect_id":{"type":"string"},"effect_type":{"type":"string"},"effect_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"failure_policy":{"type":"string","enum":["stop","continue"]},"payload":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.add_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.remove_tag"]},"tag_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","tag_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.update_field"]},"field":{"type":"string","pattern":"^(name|email|phone|document_type|document_number)$"},"value":{"type":"string","maxLength":2000}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["contact.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.update_field"]},"field":{"type":"string","pattern":"^(title|responsible_user_id)$"},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.change_state"]},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":80},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","state_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_user"]},"user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","user_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.create"]},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}}},"required":["id","type","kanban_id","column_id","title"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.update_field"]},"field":{"type":"string","enum":["title","channel","fulfillment_priority","responsible_user_id"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"string","nullable":true,"enum":[null]}]}},"required":["id","type","field","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["order.move_column"]},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","enum":["progressed","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["id","type","column_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.assign_team"]},"team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","team_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.pause_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.resume_assistant"]}},"required":["id","type"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["conversation.bind_calendar"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["id","type","calendar_id"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["message.send_template"]},"provider":{"type":"string","enum":["whatsapp_cloud"]},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["id","type","provider","channel_id","template_id","parameters"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["notification.request"]},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"category":{"default":"automation_followup","type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","minLength":1,"maxLength":500}},"required":["id","type","title","body"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.set_custom_field"]},"custom_field_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["id","type","custom_field_id","value"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"version":{"default":1,"type":"integer","minimum":1,"maximum":1},"on_failure":{"default":"stop","type":"string","enum":["stop","continue"]},"type":{"type":"string","enum":["case.record_conversion"]},"conversion_type":{"type":"string","enum":["lead_submitted","qualified_lead","purchase"]}},"required":["id","type","conversion_type"],"additionalProperties":false}]},"targets":{"type":"object","properties":{"conversation_id":{"type":"string"},"contact_id":{"type":"string"},"case_id":{"type":"string"},"order_id":{"type":"string"},"assistant_session_id":{"type":"string"},"user_id":{"type":"string"}}},"source":{"type":"object","properties":{"kind":{"type":"string","enum":["automation"]},"automation_run_id":{"type":"string"},"definition_id":{"type":"string"},"decision_id":{"type":"string"},"source_event_id":{"type":"string"}},"required":["kind","automation_run_id","definition_id","decision_id","source_event_id"]},"status":{"type":"string","enum":["running","success","skipped","failed","retry"]},"attempts":{"type":"integer","minimum":0,"maximum":9007199254740991},"result":{"type":"object","additionalProperties":{}},"error_code":{"type":"string"},"error_message":{"type":"string"},"retryable":{"type":"boolean"},"manual_retry_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"started_at":{"type":"string"},"completed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","batch_id","sequence","idempotency_key","effect_id","effect_type","effect_version","failure_policy","payload","targets","source","status","attempts","started_at"]}}},"required":["run","actions"]}},"required":["success","data"]},"AutomationRunRetrySuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"decision_id":{"type":"string"},"definition_id":{"type":"string"},"definition_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"definition_name":{"type":"string"},"source_event_id":{"type":"string"},"source_event_type":{"type":"string"},"effect_batch_id":{"type":"string"},"status":{"type":"string","enum":["running","succeeded","failed","poisoned"]},"action_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"manual_retry_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_manual_retry_at":{"type":"string"},"last_manual_retry_by":{"type":"string"},"summary":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeeded":{"type":"integer","minimum":0,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":0,"maximum":9007199254740991},"failed":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["total","succeeded","skipped","failed"]},"started_at":{"type":"string"},"completed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","decision_id","definition_id","definition_revision","definition_name","source_event_id","source_event_type","effect_batch_id","status","action_count","started_at"]}},"required":["success","data"]},"AutomationOperationsSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"window":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"]},"schedule_backlog":{"type":"object","properties":{"due_definitions":{"type":"integer","minimum":0,"maximum":9007199254740991},"oldest_due_at":{"type":"string"},"oldest_lag_ms":{"type":"integer","minimum":0,"maximum":9007199254740991},"skipped_occurrences":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["due_definitions","oldest_lag_ms","skipped_occurrences"]},"runs":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"running":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeeded":{"type":"integer","minimum":0,"maximum":9007199254740991},"failed":{"type":"integer","minimum":0,"maximum":9007199254740991},"poisoned":{"type":"integer","minimum":0,"maximum":9007199254740991},"success_rate":{"type":"number","minimum":0,"maximum":1}},"required":["total","running","succeeded","failed","poisoned","success_rate"]},"actions":{"type":"object","properties":{"running":{"type":"integer","minimum":0,"maximum":9007199254740991},"success":{"type":"integer","minimum":0,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":0,"maximum":9007199254740991},"failed":{"type":"integer","minimum":0,"maximum":9007199254740991},"retry":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["running","success","skipped","failed","retry"]},"latency_ms":{"type":"object","properties":{"average":{"type":"integer","minimum":0,"maximum":9007199254740991},"maximum":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["average","maximum"]}},"required":["window","schedule_backlog","runs","actions","latency_ms"]}},"required":["success","data"]},"CaseCreateInput":{"type":"object","properties":{"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"type_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"value":{"type":"number","minimum":0,"maximum":999999999999.99,"multipleOf":0.01},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"category":{"type":"string","minLength":1,"maxLength":100},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"label_ids":{"maxItems":30,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"source":{"type":"string","enum":["manual","inbound_message","assistant","automation","handoff","form","calendar","products"]}},"required":["contact_id","title"],"additionalProperties":false},"CaseAssignmentInput":{"type":"object","properties":{"responsible_team_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"responsible_user_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["responsible_team_id","responsible_user_id","expected_version"],"additionalProperties":false},"InboundCaseCapturePolicyInput":{"type":"object","properties":{"enabled":{"type":"boolean"},"mode":{"type":"string","enum":["reuse_latest_open","new_per_conversation"]},"type_id":{"type":"string","maxLength":24},"state_id":{"type":"string","maxLength":24},"title_template":{"type":"string","minLength":1,"maxLength":200},"expected_version":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["enabled","mode","type_id","state_id","title_template","expected_version"],"additionalProperties":false},"InboundCaseCapturePolicySuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"enabled":{"type":"boolean"},"mode":{"type":"string","enum":["reuse_latest_open","new_per_conversation"]},"type_id":{"type":"string"},"state_id":{"type":"string"},"title_template":{"type":"string"},"version":{"type":"integer","minimum":0,"maximum":9007199254740991},"status":{"type":"string","enum":["disabled","valid","invalid"]},"validation_error":{"type":"string"},"configured_by":{"type":"string"},"updated_at":{"type":"string"}},"required":["enabled","mode","type_id","state_id","title_template","version","status"]}},"required":["success","data"]},"CaseUpdateInput":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"value":{"nullable":true,"type":"number","minimum":0,"maximum":999999999999.99,"multipleOf":0.01},"currency":{"nullable":true,"type":"string","pattern":"^[A-Za-z]{3}$"},"category":{"nullable":true,"type":"string","minLength":1,"maxLength":100},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"label_ids":{"maxItems":30,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}},"additionalProperties":false},"Case":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"contact_id":{"type":"string"},"type_id":{"type":"string"},"state_id":{"type":"string"},"title":{"type":"string"},"organization_id":{"type":"string"},"product_id":{"type":"string"},"product_selection_id":{"type":"string"},"product_selection":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":"string"},"variant_id":{"type":"string"},"sku":{"type":"string"},"product_name":{"type":"string"},"variant_name":{"type":"string"},"quantity":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"unit_price":{"type":"number","minimum":0},"line_total":{"type":"number","minimum":0},"currency":{"type":"string"}},"required":["product_id","variant_id","sku","product_name","variant_name","quantity","unit_price","line_total","currency"]}},"total":{"type":"number","minimum":0},"currency":{"type":"string"},"confirmed_at":{"type":"string"}},"required":["lines","total","currency","confirmed_at"]},"order_id":{"type":"string"},"conversation_id":{"type":"string"},"value":{"type":"number"},"currency":{"type":"string"},"category":{"type":"string"},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"label_ids":{"type":"array","items":{"type":"string"}},"custom_fields":{"type":"array","items":{"type":"object","properties":{"field_id":{"type":"string"},"value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":64}}]}},"required":["field_id","value"]}},"responsible_user_id":{"type":"string"},"responsible_team_id":{"type":"string"},"responsible_user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"display_name":{"type":"string"}},"required":["id","email"]},"responsible_team":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","archived"]}},"required":["id","name","status"]},"status":{"type":"string","enum":["open","closed"]},"classification":{"type":"string"},"outcome":{"type":"string","enum":["positive","negative","cancelled","neutral"]},"closing_summary":{"type":"string"},"outcome_reason_id":{"type":"string"},"outcome_reason_snapshot":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"outcome":{"type":"string","enum":["negative","cancelled","neutral"]}},"required":["code","name","category","outcome"]},"outcome_reason_note":{"type":"string"},"outcome_reason_source":{"type":"string","enum":["manual","assistant","automation"]},"outcome_suggestion_id":{"type":"string"},"outcome_reason_confidence":{"type":"number","minimum":0,"maximum":1},"outcome_reason_evidence_message_ids":{"type":"array","items":{"type":"string"}},"objection_occurrence_id":{"type":"string"},"source":{"type":"string","enum":["manual","inbound_message","assistant","automation","handoff","form","calendar","products"]},"payment_coupon_id":{"type":"string"},"payment_status":{"type":"string","enum":["active","paid","voided"]},"payment_paid_at":{"type":"string"},"closed_at":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"attribution":{"$ref":"#/components/schemas/CaseAttributionProjection"}},"required":["_id","business_id","workspace_id","contact_id","type_id","state_id","title","status","source","version","created_by"]},"CaseSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/Case"},"message":{"type":"string"}},"required":["success","data"]},"CaseListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Case"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"CaseFunnelContact":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"document_type":{"type":"string"},"document_number":{"type":"string"},"payment_coupon_code":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}}},"required":["_id","name","tag_ids"]},"CaseFunnelCard":{"type":"object","properties":{"case":{"$ref":"#/components/schemas/Case"},"contact":{"$ref":"#/components/schemas/CaseFunnelContact"},"attribution":{"$ref":"#/components/schemas/CaseAttributionProjection"}},"required":["case","contact"]},"CaseFunnelBoardState":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/CaseState"},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"cards":{"type":"array","items":{"$ref":"#/components/schemas/CaseFunnelCard"}},"page_loaded":{"type":"boolean"},"next_cursor":{"type":"string"}},"required":["state","total","cards","page_loaded"]},"CaseFunnelBoardSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","required":["funnel_id","partial","states"],"properties":{"funnel_id":{"type":"string"},"partial":{"type":"boolean"},"states":{"type":"array","items":{"$ref":"#/components/schemas/CaseFunnelBoardState"}}}}},"required":["success","data"]},"CaseArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"case_id":{"type":"string"}},"required":["case_id"]},"message":{"type":"string"}},"required":["success","data","message"]},"CaseTransitionInput":{"type":"object","properties":{"to_state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string","minLength":1,"maxLength":80},"closing_summary":{"type":"string","minLength":1,"maxLength":2000},"outcome_reason_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"outcome_reason_note":{"type":"string","minLength":1,"maxLength":2000},"outcome_suggestion_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["to_state_id","expected_version","idempotency_key"],"additionalProperties":false},"CaseTransition":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"case_id":{"type":"string"},"from_state_id":{"type":"string"},"to_state_id":{"type":"string"},"actor_user_id":{"type":"string"},"origin":{"type":"string","enum":["manual","assistant","automation"]},"correlation_id":{"type":"string"},"causation_id":{"type":"string"},"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string","minLength":1,"maxLength":80},"from_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"to_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"resulting_status":{"type":"string","enum":["open","closed"]},"resulting_classification":{"type":"string"},"resulting_outcome":{"type":"string","enum":["positive","negative","cancelled","neutral"]},"resulting_order_id":{"type":"string"},"closing_summary":{"type":"string"},"outcome_reason_id":{"type":"string"},"outcome_reason_snapshot":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["objection","qualification","contactability","competition","operational","other"]},"outcome":{"type":"string","enum":["negative","cancelled","neutral"]}},"required":["code","name","category","outcome"]},"outcome_reason_note":{"type":"string"},"outcome_reason_source":{"type":"string","enum":["manual","assistant","automation"]},"outcome_suggestion_id":{"type":"string"},"outcome_reason_confidence":{"type":"number","minimum":0,"maximum":1},"outcome_reason_evidence_message_ids":{"type":"array","items":{"type":"string"}},"objection_occurrence_id":{"type":"string"},"occurred_at":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","business_id","workspace_id","case_id","from_state_id","to_state_id","actor_user_id","origin","idempotency_key","from_version","to_version","resulting_status","occurred_at"]},"CaseTransitionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","required":["transition","idempotent_replay"],"properties":{"transition":{"$ref":"#/components/schemas/CaseTransition"},"idempotent_replay":{"type":"boolean"}}},"message":{"type":"string"}},"required":["success","data"]},"CaseTransitionListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/CaseTransition"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"OrderCreateInput":{"type":"object","properties":{"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"organization_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"product_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"case_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"default":"normal","type":"string","enum":["low","normal","high","urgent"]},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}},"lines":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"product_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"variant_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"sku":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"unit_price":{"type":"number","minimum":0},"line_total":{"type":"number","minimum":0}},"required":["name","quantity","unit_price","line_total"],"additionalProperties":false}},"currency":{"default":"PEN","type":"string","minLength":3,"maxLength":3},"subtotal":{"type":"number","minimum":0},"total":{"default":0,"type":"number","minimum":0},"delivery_address":{"type":"string","minLength":1,"maxLength":500},"external_ref":{"type":"string","minLength":1,"maxLength":200},"responsible_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"responsible_team_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["contact_id","kanban_id","column_id","title"],"additionalProperties":false},"OrderUpdateInput":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"channel":{"nullable":true,"type":"string","minLength":1,"maxLength":100},"fulfillment_priority":{"type":"string","enum":["low","normal","high","urgent"]},"labels":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}},"organization_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"product_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"delivery_address":{"nullable":true,"type":"string","minLength":1,"maxLength":500},"responsible_user_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"responsible_team_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"additionalProperties":false},"OrderReopenInput":{"type":"object","properties":{"to_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["to_column_id","expected_version","idempotency_key"],"additionalProperties":false},"OrderTransitionInput":{"type":"object","properties":{"to_kanban_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"to_column_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string","enum":["progressed","delivered","completed","cancelled","returned","api","other"]},"completion_note":{"type":"string","minLength":1,"maxLength":2000}},"required":["to_column_id","expected_version","idempotency_key"],"additionalProperties":false},"OrderConversationLinkInput":{"type":"object","properties":{"conversation_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"make_active":{"default":true,"type":"boolean"}},"required":["conversation_id"],"additionalProperties":false},"OrdersKanban":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"module_id":{"type":"string","enum":["orders"]},"is_primary":{"type":"boolean"},"columns":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"column_type":{"type":"string","enum":["open","terminal"]},"terminal_classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"color":{"type":"string"}},"required":["_id","name","position","column_type"]}}},"required":["_id","name","module_id","is_primary","columns"]},"OrdersKanbanListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"module_id":{"type":"string","enum":["orders"]},"is_primary":{"type":"boolean"},"columns":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"column_type":{"type":"string","enum":["open","terminal"]},"terminal_classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"color":{"type":"string"}},"required":["_id","name","position","column_type"]}}},"required":["_id","name","module_id","is_primary","columns"]}}},"required":["success","data"]},"Order":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"contact_id":{"type":"string"},"organization_id":{"type":"string"},"product_id":{"type":"string"},"case_id":{"type":"string"},"conversation_id":{"type":"string"},"kanban_id":{"type":"string"},"column_id":{"type":"string"},"title":{"type":"string"},"channel":{"type":"string"},"fulfillment_priority":{"type":"string","enum":["low","normal","high","urgent"]},"labels":{"type":"array","items":{"type":"string"}},"lines":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":"string"},"variant_id":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"unit_price":{"type":"number"},"line_total":{"type":"number"}},"required":["name","quantity","unit_price","line_total"]}},"currency":{"type":"string"},"subtotal":{"type":"number","minimum":0},"total":{"type":"number","minimum":0},"delivery_address":{"type":"string"},"external_ref":{"type":"string"},"responsible_user_id":{"type":"string"},"responsible_team_id":{"type":"string"},"status":{"type":"string","enum":["open","closed"]},"classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"payment_coupon_id":{"type":"string"},"payment_status":{"type":"string","enum":["active","paid","voided"]},"payment_paid_at":{"type":"string"},"completion_note":{"type":"string"},"completed_at":{"type":"string"},"source":{"type":"string","enum":["manual","assistant","case_won","api"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"contact":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","name"]}},"required":["_id","business_id","workspace_id","contact_id","kanban_id","column_id","title","fulfillment_priority","labels","lines","currency","subtotal","total","status","source","version","created_by","contact"]},"OrderSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"contact_id":{"type":"string"},"organization_id":{"type":"string"},"product_id":{"type":"string"},"case_id":{"type":"string"},"conversation_id":{"type":"string"},"kanban_id":{"type":"string"},"column_id":{"type":"string"},"title":{"type":"string"},"channel":{"type":"string"},"fulfillment_priority":{"type":"string","enum":["low","normal","high","urgent"]},"labels":{"type":"array","items":{"type":"string"}},"lines":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":"string"},"variant_id":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"unit_price":{"type":"number"},"line_total":{"type":"number"}},"required":["name","quantity","unit_price","line_total"]}},"currency":{"type":"string"},"subtotal":{"type":"number","minimum":0},"total":{"type":"number","minimum":0},"delivery_address":{"type":"string"},"external_ref":{"type":"string"},"responsible_user_id":{"type":"string"},"responsible_team_id":{"type":"string"},"status":{"type":"string","enum":["open","closed"]},"classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"payment_coupon_id":{"type":"string"},"payment_status":{"type":"string","enum":["active","paid","voided"]},"payment_paid_at":{"type":"string"},"completion_note":{"type":"string"},"completed_at":{"type":"string"},"source":{"type":"string","enum":["manual","assistant","case_won","api"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"contact":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","name"]}},"required":["_id","business_id","workspace_id","contact_id","kanban_id","column_id","title","fulfillment_priority","labels","lines","currency","subtotal","total","status","source","version","created_by","contact"]}},"required":["success","data"]},"OrderListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"contact_id":{"type":"string"},"organization_id":{"type":"string"},"product_id":{"type":"string"},"case_id":{"type":"string"},"conversation_id":{"type":"string"},"kanban_id":{"type":"string"},"column_id":{"type":"string"},"title":{"type":"string"},"channel":{"type":"string"},"fulfillment_priority":{"type":"string","enum":["low","normal","high","urgent"]},"labels":{"type":"array","items":{"type":"string"}},"lines":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":"string"},"variant_id":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"unit_price":{"type":"number"},"line_total":{"type":"number"}},"required":["name","quantity","unit_price","line_total"]}},"currency":{"type":"string"},"subtotal":{"type":"number","minimum":0},"total":{"type":"number","minimum":0},"delivery_address":{"type":"string"},"external_ref":{"type":"string"},"responsible_user_id":{"type":"string"},"responsible_team_id":{"type":"string"},"status":{"type":"string","enum":["open","closed"]},"classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"payment_coupon_id":{"type":"string"},"payment_status":{"type":"string","enum":["active","paid","voided"]},"payment_paid_at":{"type":"string"},"completion_note":{"type":"string"},"completed_at":{"type":"string"},"source":{"type":"string","enum":["manual","assistant","case_won","api"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"contact":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","name"]}},"required":["_id","business_id","workspace_id","contact_id","kanban_id","column_id","title","fulfillment_priority","labels","lines","currency","subtotal","total","status","source","version","created_by","contact"]}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"OrderBoardSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"kanban_id":{"type":"string"},"columns":{"type":"array","items":{"type":"object","properties":{"column":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"column_type":{"type":"string","enum":["open","terminal"]},"terminal_classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"color":{"type":"string"}},"required":["_id","name","position","column_type"]},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"orders":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"contact_id":{"type":"string"},"organization_id":{"type":"string"},"product_id":{"type":"string"},"case_id":{"type":"string"},"conversation_id":{"type":"string"},"kanban_id":{"type":"string"},"column_id":{"type":"string"},"title":{"type":"string"},"channel":{"type":"string"},"fulfillment_priority":{"type":"string","enum":["low","normal","high","urgent"]},"labels":{"type":"array","items":{"type":"string"}},"lines":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":"string"},"variant_id":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"unit_price":{"type":"number"},"line_total":{"type":"number"}},"required":["name","quantity","unit_price","line_total"]}},"currency":{"type":"string"},"subtotal":{"type":"number","minimum":0},"total":{"type":"number","minimum":0},"delivery_address":{"type":"string"},"external_ref":{"type":"string"},"responsible_user_id":{"type":"string"},"responsible_team_id":{"type":"string"},"status":{"type":"string","enum":["open","closed"]},"classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"payment_coupon_id":{"type":"string"},"payment_status":{"type":"string","enum":["active","paid","voided"]},"payment_paid_at":{"type":"string"},"completion_note":{"type":"string"},"completed_at":{"type":"string"},"source":{"type":"string","enum":["manual","assistant","case_won","api"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"created_by":{"type":"string"},"updated_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"contact":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","name"]}},"required":["_id","business_id","workspace_id","contact_id","kanban_id","column_id","title","fulfillment_priority","labels","lines","currency","subtotal","total","status","source","version","created_by","contact"]}}},"required":["column","total","orders"]}}},"required":["kanban_id","columns"]}},"required":["success","data"]},"OrderTransition":{"type":"object","properties":{"_id":{"type":"string"},"order_id":{"type":"string"},"from_kanban_id":{"type":"string"},"to_kanban_id":{"type":"string"},"from_column_id":{"type":"string"},"to_column_id":{"type":"string"},"actor_user_id":{"type":"string"},"idempotency_key":{"type":"string"},"reason":{"type":"string","enum":["progressed","delivered","completed","cancelled","returned","reopened","api","other"]},"from_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"to_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"resulting_status":{"type":"string","enum":["open","closed"]},"resulting_classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"completion_note":{"type":"string"},"occurred_at":{"type":"string"}},"required":["_id","order_id","from_kanban_id","to_kanban_id","from_column_id","to_column_id","actor_user_id","idempotency_key","reason","from_version","to_version","resulting_status","occurred_at"]},"OrderTransitionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"transition":{"type":"object","properties":{"_id":{"type":"string"},"order_id":{"type":"string"},"from_kanban_id":{"type":"string"},"to_kanban_id":{"type":"string"},"from_column_id":{"type":"string"},"to_column_id":{"type":"string"},"actor_user_id":{"type":"string"},"idempotency_key":{"type":"string"},"reason":{"type":"string","enum":["progressed","delivered","completed","cancelled","returned","reopened","api","other"]},"from_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"to_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"resulting_status":{"type":"string","enum":["open","closed"]},"resulting_classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"completion_note":{"type":"string"},"occurred_at":{"type":"string"}},"required":["_id","order_id","from_kanban_id","to_kanban_id","from_column_id","to_column_id","actor_user_id","idempotency_key","reason","from_version","to_version","resulting_status","occurred_at"]},"idempotent_replay":{"type":"boolean"}},"required":["transition","idempotent_replay"]}},"required":["success","data"]},"OrderTransitionListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"order_id":{"type":"string"},"from_kanban_id":{"type":"string"},"to_kanban_id":{"type":"string"},"from_column_id":{"type":"string"},"to_column_id":{"type":"string"},"actor_user_id":{"type":"string"},"idempotency_key":{"type":"string"},"reason":{"type":"string","enum":["progressed","delivered","completed","cancelled","returned","reopened","api","other"]},"from_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"to_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"resulting_status":{"type":"string","enum":["open","closed"]},"resulting_classification":{"type":"string","enum":["delivered","completed","cancelled","returned"]},"completion_note":{"type":"string"},"occurred_at":{"type":"string"}},"required":["_id","order_id","from_kanban_id","to_kanban_id","from_column_id","to_column_id","actor_user_id","idempotency_key","reason","from_version","to_version","resulting_status","occurred_at"]}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"OrderArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"order_id":{"type":"string"}},"required":["order_id"]}},"required":["success","data"]},"AttributionEventInput":{"type":"object","properties":{"source":{"type":"string","enum":["direct","organic","paid","referral","social","email","partner","offline","other"]},"medium":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:/+-]*$"},"campaign":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:/+-]*$"},"channel":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:/+-]*$"},"external_source_ref":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:/+-]*$"},"external_campaign_ref":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:/+-]*$"},"external_key":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:/+-]*$"},"occurred_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["source"],"additionalProperties":false},"AttributionTouch":{"type":"object","properties":{"_id":{"type":"string"},"source":{"type":"string","enum":["direct","organic","paid","referral","social","email","partner","offline","other"]},"medium":{"type":"string"},"campaign":{"type":"string"},"channel":{"type":"string"},"external_source_ref":{"type":"string"},"external_campaign_ref":{"type":"string"},"occurred_at":{"type":"string"}},"required":["_id","source","occurred_at"]},"CaseAttributionProjection":{"type":"object","properties":{"first_touch":{"$ref":"#/components/schemas/AttributionTouch"},"last_touch":{"$ref":"#/components/schemas/AttributionTouch"}},"required":["first_touch","last_touch"]},"AttributionEvent":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"case_id":{"type":"string"},"actor_user_id":{"type":"string"},"source":{"type":"string","enum":["direct","organic","paid","referral","social","email","partner","offline","other"]},"medium":{"type":"string"},"campaign":{"type":"string"},"channel":{"type":"string"},"external_source_ref":{"type":"string"},"external_campaign_ref":{"type":"string"},"external_key":{"type":"string"},"occurred_at":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","business_id","workspace_id","case_id","actor_user_id","source","occurred_at"]},"AttributionEventSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","required":["event","idempotent_replay"],"properties":{"event":{"$ref":"#/components/schemas/AttributionEvent"},"idempotent_replay":{"type":"boolean"}}},"message":{"type":"string"}},"required":["success","data"]},"AttributionEventListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AttributionEvent"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"ChannelConnectionUpdateInput":{"type":"object","properties":{"display_name":{"type":"string","minLength":1,"maxLength":100},"status":{"type":"string","enum":["active","inactive"]},"conversion_events":{"type":"object","properties":{"enabled":{"type":"boolean"},"dataset_id":{"type":"string","pattern":"^\\d{5,30}$"},"test_events_enabled":{"type":"boolean"},"test_event_code":{"description":"Código de Meta Test Events. Es write-only, se cifra al persistir y nunca se devuelve.","writeOnly":true,"type":"string","minLength":1,"maxLength":100}},"required":["enabled"],"additionalProperties":false}},"additionalProperties":false},"ChannelConnection":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"provider":{"type":"string","enum":["whatsapp_cloud"]},"display_name":{"type":"string"},"meta_business_id":{"type":"string"},"waba_id":{"type":"string"},"onboarding_method":{"type":"string","enum":["embedded_signup"]},"conversion_events":{"type":"object","properties":{"enabled":{"type":"boolean"},"dataset_id":{"type":"string"},"test_events_enabled":{"type":"boolean"},"updated_at":{"type":"string"}},"required":["enabled","test_events_enabled","updated_at"]},"status":{"type":"string","enum":["active","inactive"]},"has_credentials":{"type":"boolean","enum":[true]},"credential_updated_at":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","provider","display_name","meta_business_id","waba_id","onboarding_method","conversion_events","status","has_credentials","credential_updated_at","created_by"]},"ChannelConnectionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/ChannelConnection"},"message":{"type":"string"}},"required":["success","data"]},"ChannelConnectionListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ChannelConnection"}},"message":{"type":"string"}},"required":["success","data"]},"WorkspaceChannelUpdateInput":{"type":"object","properties":{"display_name":{"type":"string","minLength":1,"maxLength":100},"status":{"type":"string","enum":["active","inactive"]},"routing_mode":{"type":"string","enum":["dedicated","general"]},"allowed_handoff_workspace_ids":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}},"additionalProperties":false},"WorkspaceChannelTransferInput":{"type":"object","properties":{"destination_workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["destination_workspace_id"],"additionalProperties":false},"WorkspaceChannel":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"connection_id":{"type":"string"},"provider":{"type":"string","enum":["whatsapp_cloud"]},"phone_number_id":{"type":"string"},"display_phone_number":{"type":"string"},"display_name":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"routing_mode":{"type":"string","enum":["dedicated","general"]},"allowed_handoff_workspace_ids":{"type":"array","items":{"type":"string"}},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","connection_id","provider","phone_number_id","display_phone_number","display_name","status","routing_mode","allowed_handoff_workspace_ids","created_by"]},"WorkspaceChannelSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/WorkspaceChannel"},"message":{"type":"string"}},"required":["success","data"]},"WorkspaceChannelListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceChannel"}},"message":{"type":"string"}},"required":["success","data"]},"MessagingArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},"message":{"type":"string"}},"required":["success","data"]},"WhatsappOnboardingStartInput":{"type":"object","properties":{"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["idempotency_key"],"additionalProperties":false},"WhatsappOnboardingCompleteInput":{"type":"object","properties":{"state":{"type":"string","minLength":32,"maxLength":256},"code":{"type":"string","minLength":8,"maxLength":4096},"meta_business_id":{"type":"string","minLength":1,"maxLength":100},"waba_id":{"type":"string","minLength":1,"maxLength":100},"phone_number_id":{"type":"string","minLength":1,"maxLength":100}},"required":["state","code","meta_business_id","waba_id","phone_number_id"],"additionalProperties":false},"WhatsappOnboardingLaunchSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"session_id":{"type":"string"},"status":{"type":"string","enum":["pending","processing","completed","failed","cancelled"]},"expires_at":{"type":"string"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"connection_id":{"type":"string"},"channel_id":{"type":"string"},"failure":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"state":{"type":"string"},"meta_app_id":{"type":"string"},"configuration_id":{"type":"string"},"graph_api_version":{"type":"string"}},"required":["session_id","status","expires_at","attempt","state","meta_app_id","configuration_id","graph_api_version"]},"message":{"type":"string"}},"required":["success","data"]},"WhatsappOnboardingSessionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"session_id":{"type":"string"},"status":{"type":"string","enum":["pending","processing","completed","failed","cancelled"]},"expires_at":{"type":"string"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"connection_id":{"type":"string"},"channel_id":{"type":"string"},"failure":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["session_id","status","expires_at","attempt"]},"message":{"type":"string"}},"required":["success","data"]},"WhatsappTemplateCreateInput":{"type":"object","properties":{"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"name":{"type":"string","minLength":1,"maxLength":512},"language":{"type":"string","pattern":"^[a-z]{2,3}(?:_[A-Z]{2})?$"},"category":{"type":"string","enum":["AUTHENTICATION","MARKETING","UTILITY"]},"body":{"type":"string","minLength":1,"maxLength":1024},"idempotency_key":{"type":"string","minLength":8,"maxLength":128}},"required":["channel_id","name","language","category","body","idempotency_key"],"additionalProperties":false},"WhatsappTemplateSyncInput":{"type":"object","properties":{"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["channel_id"],"additionalProperties":false},"WhatsappTemplate":{"type":"object","properties":{"_id":{"type":"string"},"source":{"type":"string","enum":["whatsapp_meta"]},"channel_id":{"type":"string"},"connection_id":{"type":"string"},"external_template_id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string"},"status":{"type":"string","enum":["APPROVED","DELETED","DISABLED","FLAGGED","IN_APPEAL","PAUSED","PENDING","PENDING_DELETION","REINSTATED","REJECTED","UNKNOWN"]},"quality_score":{"type":"string"},"body":{"type":"string"},"parameter_keys":{"type":"array","items":{"type":"string"}},"rejection_reason":{"type":"string"},"sync_state":{"type":"string","enum":["idle","syncing","failed"]},"sync_error_code":{"type":"string"},"last_synced_at":{"type":"string"},"last_provider_event_at":{"type":"string"},"can_use_in_broadcast":{"type":"boolean"},"can_use_in_conversation":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","source","channel_id","connection_id","external_template_id","name","language","category","status","body","parameter_keys","sync_state","can_use_in_broadcast","can_use_in_conversation"]},"WhatsappTemplateSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"source":{"type":"string","enum":["whatsapp_meta"]},"channel_id":{"type":"string"},"connection_id":{"type":"string"},"external_template_id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string"},"status":{"type":"string","enum":["APPROVED","DELETED","DISABLED","FLAGGED","IN_APPEAL","PAUSED","PENDING","PENDING_DELETION","REINSTATED","REJECTED","UNKNOWN"]},"quality_score":{"type":"string"},"body":{"type":"string"},"parameter_keys":{"type":"array","items":{"type":"string"}},"rejection_reason":{"type":"string"},"sync_state":{"type":"string","enum":["idle","syncing","failed"]},"sync_error_code":{"type":"string"},"last_synced_at":{"type":"string"},"last_provider_event_at":{"type":"string"},"can_use_in_broadcast":{"type":"boolean"},"can_use_in_conversation":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","source","channel_id","connection_id","external_template_id","name","language","category","status","body","parameter_keys","sync_state","can_use_in_broadcast","can_use_in_conversation"]},"message":{"type":"string"}},"required":["success","data"]},"WhatsappTemplateListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"source":{"type":"string","enum":["whatsapp_meta"]},"channel_id":{"type":"string"},"connection_id":{"type":"string"},"external_template_id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string"},"status":{"type":"string","enum":["APPROVED","DELETED","DISABLED","FLAGGED","IN_APPEAL","PAUSED","PENDING","PENDING_DELETION","REINSTATED","REJECTED","UNKNOWN"]},"quality_score":{"type":"string"},"body":{"type":"string"},"parameter_keys":{"type":"array","items":{"type":"string"}},"rejection_reason":{"type":"string"},"sync_state":{"type":"string","enum":["idle","syncing","failed"]},"sync_error_code":{"type":"string"},"last_synced_at":{"type":"string"},"last_provider_event_at":{"type":"string"},"can_use_in_broadcast":{"type":"boolean"},"can_use_in_conversation":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","source","channel_id","connection_id","external_template_id","name","language","category","status","body","parameter_keys","sync_state","can_use_in_broadcast","can_use_in_conversation"]}},"message":{"type":"string"}},"required":["success","data"]},"WhatsappTemplateCreateSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"source":{"type":"string","enum":["whatsapp_meta"]},"channel_id":{"type":"string"},"connection_id":{"type":"string"},"external_template_id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string"},"status":{"type":"string","enum":["APPROVED","DELETED","DISABLED","FLAGGED","IN_APPEAL","PAUSED","PENDING","PENDING_DELETION","REINSTATED","REJECTED","UNKNOWN"]},"quality_score":{"type":"string"},"body":{"type":"string"},"parameter_keys":{"type":"array","items":{"type":"string"}},"rejection_reason":{"type":"string"},"sync_state":{"type":"string","enum":["idle","syncing","failed"]},"sync_error_code":{"type":"string"},"last_synced_at":{"type":"string"},"last_provider_event_at":{"type":"string"},"can_use_in_broadcast":{"type":"boolean"},"can_use_in_conversation":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","source","channel_id","connection_id","external_template_id","name","language","category","status","body","parameter_keys","sync_state","can_use_in_broadcast","can_use_in_conversation"]},"meta":{"type":"object","properties":{"idempotent_replay":{"type":"boolean"}},"required":["idempotent_replay"]}},"required":["success","data","meta"]},"WhatsappTemplateSyncSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"source":{"type":"string","enum":["whatsapp_meta"]},"channel_id":{"type":"string"},"connection_id":{"type":"string"},"external_template_id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string"},"status":{"type":"string","enum":["APPROVED","DELETED","DISABLED","FLAGGED","IN_APPEAL","PAUSED","PENDING","PENDING_DELETION","REINSTATED","REJECTED","UNKNOWN"]},"quality_score":{"type":"string"},"body":{"type":"string"},"parameter_keys":{"type":"array","items":{"type":"string"}},"rejection_reason":{"type":"string"},"sync_state":{"type":"string","enum":["idle","syncing","failed"]},"sync_error_code":{"type":"string"},"last_synced_at":{"type":"string"},"last_provider_event_at":{"type":"string"},"can_use_in_broadcast":{"type":"boolean"},"can_use_in_conversation":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","source","channel_id","connection_id","external_template_id","name","language","category","status","body","parameter_keys","sync_state","can_use_in_broadcast","can_use_in_conversation"]}},"updated":{"type":"integer","minimum":0,"maximum":9007199254740991},"synced_at":{"type":"string"}},"required":["templates","updated","synced_at"]}},"required":["success","data"]},"ConversationAssignmentInput":{"type":"object","properties":{"assigned_user_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"assigned_team_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["assigned_user_id","expected_version"],"additionalProperties":false},"ConversationLifecycleInput":{"type":"object","properties":{"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["expected_version"],"additionalProperties":false},"ConversationCaseInput":{"type":"object","properties":{"case_id":{"nullable":true,"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["case_id","expected_version"],"additionalProperties":false},"Conversation":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"origin_workspace_id":{"type":"string"},"channel_id":{"type":"string"},"contact_id":{"type":"string"},"case_id":{"type":"string"},"case_ids":{"type":"array","items":{"type":"string"}},"order_ids":{"type":"array","items":{"type":"string"}},"active_context":{"type":"object","properties":{"type":{"type":"string","enum":["case","order"]},"id":{"type":"string"}},"required":["type","id"]},"assigned_user_id":{"type":"string"},"assigned_team_id":{"type":"string"},"assignment_reason":{"type":"string","enum":["manual","round_robin","no_eligible_member"]},"assignment_evaluated_at":{"type":"string"},"assigned_at":{"type":"string"},"status":{"type":"string","enum":["open","closed"]},"contact_display_name":{"type":"string"},"contact_address":{"type":"string"},"last_message_id":{"type":"string"},"last_message_at":{"type":"string"},"last_message_preview":{"type":"string"},"last_message_direction":{"type":"string","enum":["inbound","outbound"]},"free_form_window":{"type":"object","properties":{"state":{"type":"string","enum":["open","closed","unknown"]},"expires_at":{"type":"string"},"source":{"type":"string","enum":["referral_conversion","last_inbound_24h","unknown"]}},"required":["state","source"]},"acquisition":{"type":"object","properties":{"provider":{"type":"string","enum":["meta"]},"channel":{"type":"string","enum":["whatsapp_cloud"]},"source_type":{"type":"string","enum":["ad","post"]},"source_id":{"type":"string"},"source_url":{"type":"string","format":"uri"},"headline":{"type":"string"},"body":{"type":"string"},"media_type":{"type":"string"},"image_url":{"type":"string","format":"uri"},"video_url":{"type":"string","format":"uri"},"thumbnail_url":{"type":"string","format":"uri"},"occurred_at":{"type":"string"}},"required":["provider","channel","occurred_at"]},"assistant_summary":{"type":"object","properties":{"session_id":{"type":"string"},"session_status":{"type":"string"},"control_mode":{"type":"string","enum":["assistant","human"]},"activity_status":{"type":"string","enum":["idle","queued","processing","retrying","failed"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"updated_at":{"type":"string"},"error_code":{"type":"string"}},"required":["session_id","session_status","control_mode","activity_status","version","updated_at"]},"unread_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"opened_at":{"type":"string"},"closed_at":{"type":"string"},"closed_by":{"type":"string"},"closed_reason":{"type":"string","enum":["manual","case_terminal","ticket_terminal"]},"case_transition_id":{"type":"string"},"case_transition_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"case_status_snapshot":{"type":"string","enum":["open","closed"]},"case_classification_snapshot":{"type":"string"},"case_outcome_snapshot":{"type":"string","enum":["positive","negative","cancelled","neutral"]},"case_transition_reason_snapshot":{"type":"string","enum":["progressed","qualified","disqualified","won","lost","other"]},"payment_coupon_id":{"type":"string"},"payment_status":{"type":"string","enum":["active","paid","voided"]},"payment_paid_at":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"handoff_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_handoff_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","origin_workspace_id","channel_id","contact_id","status","contact_display_name","free_form_window","unread_count","opened_at","version","handoff_count"]},"ConversationSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/Conversation"},"message":{"type":"string"}},"required":["success","data"]},"ConversationListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"Message":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"conversation_id":{"type":"string"},"channel_id":{"type":"string"},"contact_id":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"type":{"type":"string","enum":["text","image","audio","video","document","sticker","location","contacts","order","template","interactive","reaction","unknown"]},"text":{"type":"string"},"interactive_payload":{"type":"string"},"interactive_options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"}},"required":["id","title"]}},"interactive_header":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image","video","document"]},"media":{"type":"object","properties":{"content_type":{"type":"string"},"filename":{"type":"string"},"size_bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"download_url":{"type":"string"}},"required":["content_type"]}},"required":["type","media"]}]},"whatsapp_template":{"type":"object","properties":{"binding_id":{"type":"string"},"whatsapp_template_id":{"type":"string"},"external_template_id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string"},"index":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["type","text","index"]}},"content_fingerprint":{"type":"string"},"rendered_text":{"type":"string"}},"required":["binding_id","whatsapp_template_id","external_template_id","name","language","parameters","content_fingerprint","rendered_text"]},"external_message_id":{"type":"string"},"provider_message_id":{"type":"string"},"status":{"type":"string","enum":["received","queued","sent","delivered","read","failed"]},"occurred_at":{"type":"string"},"status_updated_at":{"type":"string"},"delivery_attempts":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_delivery_attempt_at":{"type":"string"},"error_code":{"type":"string"},"failure_reason":{"type":"string","enum":["free_form_window_closed"]},"media":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"content_type":{"type":"string"},"filename":{"type":"string"},"voice":{"type":"boolean"},"size_bytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"download_url":{"type":"string"}},"required":["content_type"]},"location":{"type":"object","properties":{"latitude":{"type":"number","minimum":-90,"maximum":90},"longitude":{"type":"number","minimum":-180,"maximum":180},"name":{"type":"string","minLength":1,"maxLength":1000},"address":{"type":"string","minLength":1,"maxLength":1000}},"required":["latitude","longitude"],"additionalProperties":false},"contacts":{"type":"array","items":{"type":"object","properties":{"name":{"type":"object","properties":{"formatted_name":{"type":"string","minLength":1,"maxLength":200},"first_name":{"type":"string","minLength":1,"maxLength":100},"last_name":{"type":"string","minLength":1,"maxLength":100}},"required":["formatted_name","first_name"],"additionalProperties":false},"phones":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":3,"maxLength":30},"type":{"type":"string","maxLength":30},"wa_id":{"type":"string","maxLength":30}},"required":["phone"],"additionalProperties":false}},"emails":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"type":{"type":"string","maxLength":30}},"required":["email"],"additionalProperties":false}},"organization":{"type":"object","properties":{"company":{"type":"string","minLength":1,"maxLength":200},"department":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":200}},"additionalProperties":false}},"required":["name"],"additionalProperties":false}},"interactive_content":{"type":"object","properties":{"type":{"type":"string","enum":["button","list","product","product_list"]},"header":{"type":"string","minLength":1,"maxLength":60},"body":{"type":"string","minLength":1,"maxLength":1024},"footer":{"type":"string","minLength":1,"maxLength":60},"button":{"type":"string","minLength":1,"maxLength":20},"options":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":24},"description":{"type":"string","minLength":1,"maxLength":72},"section":{"type":"string","minLength":1,"maxLength":24}},"required":["id","title"],"additionalProperties":false}},"catalog_id":{"type":"string","minLength":1,"maxLength":100},"product_retailer_id":{"type":"string","minLength":1,"maxLength":100},"product_sections":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":24},"product_retailer_ids":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}}},"required":["title","product_retailer_ids"],"additionalProperties":false}}},"required":["type"],"additionalProperties":false},"order":{"type":"object","properties":{"catalog_id":{"type":"string"},"text":{"type":"string"},"product_items":{"type":"array","items":{"type":"object","properties":{"product_retailer_id":{"type":"string"},"quantity":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"item_price":{"type":"number","minimum":0},"currency":{"type":"string"}},"required":["product_retailer_id","quantity","item_price","currency"]}}},"required":["product_items"]},"reaction":{"type":"object","properties":{"emoji":{"type":"string"}},"required":["emoji"]},"reply_to_message_id":{"type":"string"},"reply_to_external_message_id":{"type":"string"},"referral":{"type":"object","properties":{"source_id":{"type":"string"},"source_url":{"type":"string"},"source_type":{"type":"string","enum":["ad","post"]},"headline":{"type":"string"},"body":{"type":"string"},"media_type":{"type":"string"},"image_url":{"type":"string"},"video_url":{"type":"string"},"thumbnail_url":{"type":"string"}}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","conversation_id","channel_id","contact_id","direction","type","external_message_id","status","occurred_at","status_updated_at"]},"MessageListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"meta":{"type":"object","properties":{"total":{"type":"number","example":15},"page":{"type":"number","example":1},"limit":{"type":"number","example":10},"total_pages":{"type":"number","example":2}},"required":["total","page","limit","total_pages"]}},"required":["success","data","meta"]},"InboxRealtimeAccessSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"enabled":{"type":"boolean","enum":[true]}},"required":["enabled"]},"message":{"type":"string"}},"required":["success","data"]},"InboxRealtimeCursorSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"cursor":{"type":"integer","minimum":0,"maximum":9007199254740991},"server_time":{"type":"string"}},"required":["cursor","server_time"]},"message":{"type":"string"}},"required":["success","data"]},"InboxRealtimeChangesSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"changes":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"event_id":{"type":"string"},"event_type":{"type":"string"},"resource_kind":{"type":"string","enum":["conversation","message","assistant_session"]},"conversation_id":{"type":"string"},"message_id":{"type":"string"},"assistant_session_id":{"type":"string"},"resource_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"event_occurred_at":{"type":"string"},"projected_at":{"type":"string"}},"required":["sequence","event_id","event_type","resource_kind","conversation_id","event_occurred_at","projected_at"]}},"cursor":{"type":"integer","minimum":0,"maximum":9007199254740991},"current_cursor":{"type":"integer","minimum":0,"maximum":9007199254740991},"has_more":{"type":"boolean"},"reset_required":{"type":"boolean"},"server_time":{"type":"string"}},"required":["changes","cursor","current_cursor","has_more","reset_required","server_time"]},"message":{"type":"string"}},"required":["success","data"]},"FreeFormWindowClosedError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string"},"code":{"type":"string","enum":["FREE_FORM_WINDOW_CLOSED"]},"data":{"type":"object","properties":{"free_form_window":{"type":"object","properties":{"state":{"type":"string","enum":["closed"]},"expires_at":{"type":"string"},"source":{"type":"string","enum":["referral_conversion","last_inbound_24h"]}},"required":["state","expires_at","source"]},"requires_template":{"type":"boolean","enum":[true]}},"required":["free_form_window","requires_template"]}},"required":["success","error","code","data"]},"OutboundMediaUploadInput":{"type":"object","properties":{"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["image","audio","video","document","sticker"]},"content_type":{"type":"string","minLength":1,"maxLength":200},"size_bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":104857600},"filename":{"type":"string","minLength":1,"maxLength":255},"voice":{"type":"boolean"}},"required":["idempotency_key","type","content_type","size_bytes"],"additionalProperties":false},"OutboundMediaCompleteInput":{"type":"object","properties":{"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["image","audio","video","document","sticker"]},"content_type":{"type":"string","minLength":1,"maxLength":200},"size_bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":104857600},"filename":{"type":"string","minLength":1,"maxLength":255},"voice":{"type":"boolean"},"upload_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"caption":{"type":"string","minLength":1,"maxLength":1024},"reply_to_message_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["idempotency_key","type","content_type","size_bytes","upload_id"],"additionalProperties":false},"OutboundMediaUploadSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"upload_id":{"type":"string"},"upload_url":{"type":"string","format":"uri"},"expires_at":{"type":"string"},"content_type":{"type":"string"}},"required":["upload_id","upload_url","expires_at","content_type"]},"message":{"type":"string"}},"required":["success","data"]},"OutboundMessageInput":{"type":"object","properties":{"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["text","location","contacts","reaction","interactive"]},"text":{"type":"string","minLength":1,"maxLength":4096},"location":{"type":"object","properties":{"latitude":{"type":"number","minimum":-90,"maximum":90},"longitude":{"type":"number","minimum":-180,"maximum":180},"name":{"type":"string","minLength":1,"maxLength":1000},"address":{"type":"string","minLength":1,"maxLength":1000}},"required":["latitude","longitude"],"additionalProperties":false},"contacts":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"object","properties":{"name":{"type":"object","properties":{"formatted_name":{"type":"string","minLength":1,"maxLength":200},"first_name":{"type":"string","minLength":1,"maxLength":100},"last_name":{"type":"string","minLength":1,"maxLength":100}},"required":["formatted_name","first_name"],"additionalProperties":false},"phones":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":3,"maxLength":30},"type":{"type":"string","maxLength":30},"wa_id":{"type":"string","maxLength":30}},"required":["phone"],"additionalProperties":false}},"emails":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"type":{"type":"string","maxLength":30}},"required":["email"],"additionalProperties":false}},"organization":{"type":"object","properties":{"company":{"type":"string","minLength":1,"maxLength":200},"department":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":200}},"additionalProperties":false}},"required":["name"],"additionalProperties":false}},"reaction":{"type":"object","properties":{"emoji":{"type":"string","maxLength":16},"target_message_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["emoji","target_message_id"],"additionalProperties":false},"interactive_content":{"type":"object","properties":{"type":{"type":"string","enum":["button","list","product","product_list"]},"header":{"type":"string","minLength":1,"maxLength":60},"body":{"type":"string","minLength":1,"maxLength":1024},"footer":{"type":"string","minLength":1,"maxLength":60},"button":{"type":"string","minLength":1,"maxLength":20},"options":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":24},"description":{"type":"string","minLength":1,"maxLength":72},"section":{"type":"string","minLength":1,"maxLength":24}},"required":["id","title"],"additionalProperties":false}},"catalog_id":{"type":"string","minLength":1,"maxLength":100},"product_retailer_id":{"type":"string","minLength":1,"maxLength":100},"product_sections":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":24},"product_retailer_ids":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}}},"required":["title","product_retailer_ids"],"additionalProperties":false}}},"required":["type"],"additionalProperties":false},"reply_to_message_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["idempotency_key","type"],"additionalProperties":false},"OutboundMessageSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","required":["message","idempotent_replay"],"properties":{"message":{"$ref":"#/components/schemas/Message"},"idempotent_replay":{"type":"boolean"}}}},"required":["success","data"]},"OutboundTemplateMessageInput":{"type":"object","properties":{"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"binding_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["idempotency_key","binding_id","parameters"],"additionalProperties":false},"StartTemplateConversationInput":{"type":"object","properties":{"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"binding_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}},"channel_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"case_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["idempotency_key","binding_id","parameters","channel_id","contact_id"],"additionalProperties":false},"StartTemplateConversationSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"conversation":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"origin_workspace_id":{"type":"string"},"channel_id":{"type":"string"},"contact_id":{"type":"string"},"case_id":{"type":"string"},"case_ids":{"type":"array","items":{"type":"string"}},"order_ids":{"type":"array","items":{"type":"string"}},"active_context":{"type":"object","properties":{"type":{"type":"string","enum":["case","order"]},"id":{"type":"string"}},"required":["type","id"]},"assigned_user_id":{"type":"string"},"assigned_team_id":{"type":"string"},"assignment_reason":{"type":"string","enum":["manual","round_robin","no_eligible_member"]},"assignment_evaluated_at":{"type":"string"},"assigned_at":{"type":"string"},"status":{"type":"string","enum":["open","closed"]},"contact_display_name":{"type":"string"},"contact_address":{"type":"string"},"last_message_id":{"type":"string"},"last_message_at":{"type":"string"},"last_message_preview":{"type":"string"},"last_message_direction":{"type":"string","enum":["inbound","outbound"]},"free_form_window":{"type":"object","properties":{"state":{"type":"string","enum":["open","closed","unknown"]},"expires_at":{"type":"string"},"source":{"type":"string","enum":["referral_conversion","last_inbound_24h","unknown"]}},"required":["state","source"]},"acquisition":{"type":"object","properties":{"provider":{"type":"string","enum":["meta"]},"channel":{"type":"string","enum":["whatsapp_cloud"]},"source_type":{"type":"string","enum":["ad","post"]},"source_id":{"type":"string"},"source_url":{"type":"string","format":"uri"},"headline":{"type":"string"},"body":{"type":"string"},"media_type":{"type":"string"},"image_url":{"type":"string","format":"uri"},"video_url":{"type":"string","format":"uri"},"thumbnail_url":{"type":"string","format":"uri"},"occurred_at":{"type":"string"}},"required":["provider","channel","occurred_at"]},"assistant_summary":{"type":"object","properties":{"session_id":{"type":"string"},"session_status":{"type":"string"},"control_mode":{"type":"string","enum":["assistant","human"]},"activity_status":{"type":"string","enum":["idle","queued","processing","retrying","failed"]},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"updated_at":{"type":"string"},"error_code":{"type":"string"}},"required":["session_id","session_status","control_mode","activity_status","version","updated_at"]},"unread_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"opened_at":{"type":"string"},"closed_at":{"type":"string"},"closed_by":{"type":"string"},"closed_reason":{"type":"string","enum":["manual","case_terminal","ticket_terminal"]},"case_transition_id":{"type":"string"},"case_transition_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"case_status_snapshot":{"type":"string","enum":["open","closed"]},"case_classification_snapshot":{"type":"string"},"case_outcome_snapshot":{"type":"string","enum":["positive","negative","cancelled","neutral"]},"case_transition_reason_snapshot":{"type":"string","enum":["progressed","qualified","disqualified","won","lost","other"]},"payment_coupon_id":{"type":"string"},"payment_status":{"type":"string","enum":["active","paid","voided"]},"payment_paid_at":{"type":"string"},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"handoff_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_handoff_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","origin_workspace_id","channel_id","contact_id","status","contact_display_name","free_form_window","unread_count","opened_at","version","handoff_count"]},"message":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"conversation_id":{"type":"string"},"channel_id":{"type":"string"},"contact_id":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"type":{"type":"string","enum":["text","image","audio","video","document","sticker","location","contacts","order","template","interactive","reaction","unknown"]},"text":{"type":"string"},"interactive_payload":{"type":"string"},"interactive_options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"}},"required":["id","title"]}},"interactive_header":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":60}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image","video","document"]},"media":{"type":"object","properties":{"content_type":{"type":"string"},"filename":{"type":"string"},"size_bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"download_url":{"type":"string"}},"required":["content_type"]}},"required":["type","media"]}]},"whatsapp_template":{"type":"object","properties":{"binding_id":{"type":"string"},"whatsapp_template_id":{"type":"string"},"external_template_id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string"},"index":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["type","text","index"]}},"content_fingerprint":{"type":"string"},"rendered_text":{"type":"string"}},"required":["binding_id","whatsapp_template_id","external_template_id","name","language","parameters","content_fingerprint","rendered_text"]},"external_message_id":{"type":"string"},"provider_message_id":{"type":"string"},"status":{"type":"string","enum":["received","queued","sent","delivered","read","failed"]},"occurred_at":{"type":"string"},"status_updated_at":{"type":"string"},"delivery_attempts":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_delivery_attempt_at":{"type":"string"},"error_code":{"type":"string"},"failure_reason":{"type":"string","enum":["free_form_window_closed"]},"media":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"content_type":{"type":"string"},"filename":{"type":"string"},"voice":{"type":"boolean"},"size_bytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"download_url":{"type":"string"}},"required":["content_type"]},"location":{"type":"object","properties":{"latitude":{"type":"number","minimum":-90,"maximum":90},"longitude":{"type":"number","minimum":-180,"maximum":180},"name":{"type":"string","minLength":1,"maxLength":1000},"address":{"type":"string","minLength":1,"maxLength":1000}},"required":["latitude","longitude"],"additionalProperties":false},"contacts":{"type":"array","items":{"type":"object","properties":{"name":{"type":"object","properties":{"formatted_name":{"type":"string","minLength":1,"maxLength":200},"first_name":{"type":"string","minLength":1,"maxLength":100},"last_name":{"type":"string","minLength":1,"maxLength":100}},"required":["formatted_name","first_name"],"additionalProperties":false},"phones":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":3,"maxLength":30},"type":{"type":"string","maxLength":30},"wa_id":{"type":"string","maxLength":30}},"required":["phone"],"additionalProperties":false}},"emails":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"type":{"type":"string","maxLength":30}},"required":["email"],"additionalProperties":false}},"organization":{"type":"object","properties":{"company":{"type":"string","minLength":1,"maxLength":200},"department":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":200}},"additionalProperties":false}},"required":["name"],"additionalProperties":false}},"interactive_content":{"type":"object","properties":{"type":{"type":"string","enum":["button","list","product","product_list"]},"header":{"type":"string","minLength":1,"maxLength":60},"body":{"type":"string","minLength":1,"maxLength":1024},"footer":{"type":"string","minLength":1,"maxLength":60},"button":{"type":"string","minLength":1,"maxLength":20},"options":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":24},"description":{"type":"string","minLength":1,"maxLength":72},"section":{"type":"string","minLength":1,"maxLength":24}},"required":["id","title"],"additionalProperties":false}},"catalog_id":{"type":"string","minLength":1,"maxLength":100},"product_retailer_id":{"type":"string","minLength":1,"maxLength":100},"product_sections":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":24},"product_retailer_ids":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}}},"required":["title","product_retailer_ids"],"additionalProperties":false}}},"required":["type"],"additionalProperties":false},"order":{"type":"object","properties":{"catalog_id":{"type":"string"},"text":{"type":"string"},"product_items":{"type":"array","items":{"type":"object","properties":{"product_retailer_id":{"type":"string"},"quantity":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"item_price":{"type":"number","minimum":0},"currency":{"type":"string"}},"required":["product_retailer_id","quantity","item_price","currency"]}}},"required":["product_items"]},"reaction":{"type":"object","properties":{"emoji":{"type":"string"}},"required":["emoji"]},"reply_to_message_id":{"type":"string"},"reply_to_external_message_id":{"type":"string"},"referral":{"type":"object","properties":{"source_id":{"type":"string"},"source_url":{"type":"string"},"source_type":{"type":"string","enum":["ad","post"]},"headline":{"type":"string"},"body":{"type":"string"},"media_type":{"type":"string"},"image_url":{"type":"string"},"video_url":{"type":"string"},"thumbnail_url":{"type":"string"}}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","conversation_id","channel_id","contact_id","direction","type","external_message_id","status","occurred_at","status_updated_at"]},"idempotent_replay":{"type":"boolean"}},"required":["conversation","message","idempotent_replay"]}},"required":["success","data"]},"ConversationHandoffInput":{"type":"object","properties":{"destination_workspace_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"expected_version":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991},"mode":{"default":"manual","type":"string","enum":["manual","assistant"]},"reason":{"type":"string","minLength":3,"maxLength":500},"intent":{"type":"string","minLength":1,"maxLength":100}},"required":["destination_workspace_id","expected_version","reason"],"additionalProperties":false},"ConversationHandoff":{"type":"object","properties":{"_id":{"type":"string"},"conversation_id":{"type":"string"},"channel_id":{"type":"string"},"contact_id":{"type":"string"},"source_workspace_id":{"type":"string"},"destination_workspace_id":{"type":"string"},"mode":{"type":"string","enum":["manual","assistant"]},"reason":{"type":"string"},"intent":{"type":"string"},"source_case_id":{"type":"string"},"source_assigned_user_id":{"type":"string"},"source_assigned_team_id":{"type":"string"},"performed_by":{"type":"string"},"occurred_at":{"type":"string"}},"required":["_id","conversation_id","channel_id","contact_id","source_workspace_id","destination_workspace_id","mode","reason","performed_by","occurred_at"]},"ConversationHandoffSuccess":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/ConversationHandoff"}}},"ConversationHandoffListSuccess":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ConversationHandoff"}}}},"PublicFormField":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["text","email","phone"]},"required":{"type":"boolean"},"target":{"type":"string","enum":["contact_name","contact_email","contact_phone"]}},"required":["key","label","type","required","target"],"additionalProperties":false},"FormDefinitionInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"slug":{"type":"string","minLength":3,"maxLength":80,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"description":{"type":"string","maxLength":500},"status":{"type":"string","enum":["active","inactive"]},"fields":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["text","email","phone"]},"required":{"type":"boolean"},"target":{"type":"string","enum":["contact_name","contact_email","contact_phone"]}},"required":["key","label","type","required","target"],"additionalProperties":false}},"case_type_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"case_state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"case_title":{"type":"string","minLength":1,"maxLength":200},"attribution_source":{"type":"string","enum":["direct","organic","paid","referral","social","email","partner","offline","other"]},"attribution_campaign":{"type":"string","minLength":1,"maxLength":100}},"required":["name","slug","status","fields","case_title","attribution_source"],"additionalProperties":false},"FormDefinition":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["text","email","phone"]},"required":{"type":"boolean"},"target":{"type":"string","enum":["contact_name","contact_email","contact_phone"]}},"required":["key","label","type","required","target"],"additionalProperties":false}},"case_type_id":{"type":"string"},"case_state_id":{"type":"string"},"case_title":{"type":"string"},"attribution_source":{"type":"string"},"attribution_campaign":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","slug","status","fields","case_title","attribution_source","created_by"]},"FormDefinitionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["text","email","phone"]},"required":{"type":"boolean"},"target":{"type":"string","enum":["contact_name","contact_email","contact_phone"]}},"required":["key","label","type","required","target"],"additionalProperties":false}},"case_type_id":{"type":"string"},"case_state_id":{"type":"string"},"case_title":{"type":"string"},"attribution_source":{"type":"string"},"attribution_campaign":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","slug","status","fields","case_title","attribution_source","created_by"]}},"required":["success","data"]},"FormDefinitionListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"business_id":{"type":"string"},"workspace_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["text","email","phone"]},"required":{"type":"boolean"},"target":{"type":"string","enum":["contact_name","contact_email","contact_phone"]}},"required":["key","label","type","required","target"],"additionalProperties":false}},"case_type_id":{"type":"string"},"case_state_id":{"type":"string"},"case_title":{"type":"string"},"attribution_source":{"type":"string"},"attribution_campaign":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","business_id","workspace_id","name","slug","status","fields","case_title","attribution_source","created_by"]}}},"required":["success","data"]},"FormArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"form_id":{"type":"string"}},"required":["form_id"]}},"required":["success","data"]},"CalendarConfigurationInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"owner_type":{"default":"user","type":"string","enum":["user","workspace"]},"timezone":{"type":"string","minLength":1,"maxLength":100},"status":{"type":"string","enum":["active","inactive"]},"weekly_availability":{"minItems":1,"maxItems":28,"type":"array","items":{"type":"object","properties":{"weekday":{"type":"integer","minimum":0,"maximum":6},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["weekday","start_time","end_time"],"additionalProperties":false}},"minimum_notice_minutes":{"type":"integer","minimum":0,"maximum":43200},"booking_horizon_days":{"type":"integer","minimum":1,"maximum":365},"booking_type":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"duration_minutes":{"type":"integer","minimum":5,"maximum":1440},"slot_interval_minutes":{"type":"integer","minimum":5,"maximum":1440},"buffer_before_minutes":{"default":0,"type":"integer","minimum":0,"maximum":240},"buffer_after_minutes":{"default":0,"type":"integer","minimum":0,"maximum":240}},"required":["name","duration_minutes","slot_interval_minutes"],"additionalProperties":false},"public_link":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"slug":{"type":"string","minLength":3,"maxLength":80,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"description":{"type":"string","maxLength":500},"status":{"type":"string","enum":["active","inactive"]},"case_type_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"case_state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"case_title":{"type":"string","minLength":1,"maxLength":200}},"required":["name","slug","status"],"additionalProperties":false}},"required":["name","timezone","status","weekly_availability","minimum_notice_minutes","booking_horizon_days","booking_type","public_link"],"additionalProperties":false},"CalendarConfiguration":{"type":"object","properties":{"calendar":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"owner_type":{"type":"string","enum":["user","workspace"]},"owner_user_id":{"type":"string"},"timezone":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"weekly_availability":{"type":"array","items":{"type":"object","properties":{"weekday":{"type":"integer","minimum":0,"maximum":6},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["weekday","start_time","end_time"],"additionalProperties":false}},"minimum_notice_minutes":{"type":"number"},"booking_horizon_days":{"type":"number"}},"required":["_id","name","owner_type","timezone","status","weekly_availability","minimum_notice_minutes","booking_horizon_days"]},"booking_type":{"type":"object","properties":{"_id":{"type":"string"},"calendar_id":{"type":"string"},"name":{"type":"string"},"duration_minutes":{"type":"number"},"slot_interval_minutes":{"type":"number"},"buffer_before_minutes":{"type":"number"},"buffer_after_minutes":{"type":"number"},"status":{"type":"string","enum":["active","inactive"]}},"required":["_id","calendar_id","name","duration_minutes","slot_interval_minutes","buffer_before_minutes","buffer_after_minutes","status"]},"binding_id":{"type":"string"},"public_link":{"type":"object","properties":{"_id":{"type":"string"},"calendar_id":{"type":"string"},"booking_type_id":{"type":"string"},"calendar_binding_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"case_type_id":{"type":"string"},"case_state_id":{"type":"string"},"case_title":{"type":"string"}},"required":["_id","calendar_id","booking_type_id","calendar_binding_id","name","slug","status"]}},"required":["calendar","booking_type","binding_id","public_link"]},"CalendarConfigurationSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"calendar":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"owner_type":{"type":"string","enum":["user","workspace"]},"owner_user_id":{"type":"string"},"timezone":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"weekly_availability":{"type":"array","items":{"type":"object","properties":{"weekday":{"type":"integer","minimum":0,"maximum":6},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["weekday","start_time","end_time"],"additionalProperties":false}},"minimum_notice_minutes":{"type":"number"},"booking_horizon_days":{"type":"number"}},"required":["_id","name","owner_type","timezone","status","weekly_availability","minimum_notice_minutes","booking_horizon_days"]},"booking_type":{"type":"object","properties":{"_id":{"type":"string"},"calendar_id":{"type":"string"},"name":{"type":"string"},"duration_minutes":{"type":"number"},"slot_interval_minutes":{"type":"number"},"buffer_before_minutes":{"type":"number"},"buffer_after_minutes":{"type":"number"},"status":{"type":"string","enum":["active","inactive"]}},"required":["_id","calendar_id","name","duration_minutes","slot_interval_minutes","buffer_before_minutes","buffer_after_minutes","status"]},"binding_id":{"type":"string"},"public_link":{"type":"object","properties":{"_id":{"type":"string"},"calendar_id":{"type":"string"},"booking_type_id":{"type":"string"},"calendar_binding_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"case_type_id":{"type":"string"},"case_state_id":{"type":"string"},"case_title":{"type":"string"}},"required":["_id","calendar_id","booking_type_id","calendar_binding_id","name","slug","status"]}},"required":["calendar","booking_type","binding_id","public_link"]}},"required":["success","data"]},"CalendarConfigurationListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"calendar":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"owner_type":{"type":"string","enum":["user","workspace"]},"owner_user_id":{"type":"string"},"timezone":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"weekly_availability":{"type":"array","items":{"type":"object","properties":{"weekday":{"type":"integer","minimum":0,"maximum":6},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["weekday","start_time","end_time"],"additionalProperties":false}},"minimum_notice_minutes":{"type":"number"},"booking_horizon_days":{"type":"number"}},"required":["_id","name","owner_type","timezone","status","weekly_availability","minimum_notice_minutes","booking_horizon_days"]},"booking_type":{"type":"object","properties":{"_id":{"type":"string"},"calendar_id":{"type":"string"},"name":{"type":"string"},"duration_minutes":{"type":"number"},"slot_interval_minutes":{"type":"number"},"buffer_before_minutes":{"type":"number"},"buffer_after_minutes":{"type":"number"},"status":{"type":"string","enum":["active","inactive"]}},"required":["_id","calendar_id","name","duration_minutes","slot_interval_minutes","buffer_before_minutes","buffer_after_minutes","status"]},"binding_id":{"type":"string"},"public_link":{"type":"object","properties":{"_id":{"type":"string"},"calendar_id":{"type":"string"},"booking_type_id":{"type":"string"},"calendar_binding_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"case_type_id":{"type":"string"},"case_state_id":{"type":"string"},"case_title":{"type":"string"}},"required":["_id","calendar_id","booking_type_id","calendar_binding_id","name","slug","status"]}},"required":["calendar","booking_type","binding_id","public_link"]}}},"required":["success","data"]},"CalendarArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"calendar_id":{"type":"string"}},"required":["calendar_id"]}},"required":["success","data"]},"CalendarEntry":{"type":"object","properties":{"_id":{"type":"string"},"kind":{"type":"string","enum":["appointment","block"]},"title":{"type":"string"},"calendar_id":{"type":"string"},"booking_type_id":{"type":"string"},"calendar_binding_id":{"type":"string"},"contact_id":{"type":"string"},"conversation_id":{"type":"string"},"assistant_session_id":{"type":"string"},"case_id":{"type":"string"},"start_at":{"type":"string"},"end_at":{"type":"string"},"timezone":{"type":"string"},"status":{"type":"string","enum":["active","cancelled"]}},"required":["_id","kind","calendar_id","start_at","end_at","timezone","status"]},"CalendarEntryInput":{"type":"object","properties":{"kind":{"type":"string","enum":["appointment","block"]},"calendar_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"binding_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"case_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"title":{"type":"string","minLength":1,"maxLength":150},"start_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"end_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kind","calendar_id","title","start_at","idempotency_key"],"additionalProperties":false},"CalendarEntryRescheduleInput":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":150},"start_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"end_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"idempotency_key":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["title","start_at","idempotency_key"],"additionalProperties":false},"CalendarAvailabilitySuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"timezone":{"type":"string"},"duration_minutes":{"type":"number"},"slots":{"type":"array","items":{"type":"object","properties":{"start_at":{"type":"string"},"end_at":{"type":"string"},"local_date":{"type":"string"},"local_time":{"type":"string"}},"required":["start_at","end_at","local_date","local_time"]}}},"required":["timezone","duration_minutes","slots"]}},"required":["success","data"]},"CalendarEntrySuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"kind":{"type":"string","enum":["appointment","block"]},"title":{"type":"string"},"calendar_id":{"type":"string"},"booking_type_id":{"type":"string"},"calendar_binding_id":{"type":"string"},"contact_id":{"type":"string"},"conversation_id":{"type":"string"},"assistant_session_id":{"type":"string"},"case_id":{"type":"string"},"start_at":{"type":"string"},"end_at":{"type":"string"},"timezone":{"type":"string"},"status":{"type":"string","enum":["active","cancelled"]}},"required":["_id","kind","calendar_id","start_at","end_at","timezone","status"]}},"required":["success","data"]},"CalendarEntryListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"kind":{"type":"string","enum":["appointment","block"]},"title":{"type":"string"},"calendar_id":{"type":"string"},"booking_type_id":{"type":"string"},"calendar_binding_id":{"type":"string"},"contact_id":{"type":"string"},"conversation_id":{"type":"string"},"assistant_session_id":{"type":"string"},"case_id":{"type":"string"},"start_at":{"type":"string"},"end_at":{"type":"string"},"timezone":{"type":"string"},"status":{"type":"string","enum":["active","cancelled"]}},"required":["_id","kind","calendar_id","start_at","end_at","timezone","status"]}}},"required":["success","data"]},"CalendarEntryCancelSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"entry_id":{"type":"string"}},"required":["entry_id"]}},"required":["success","data"]},"CalendarReminder":{"type":"object","properties":{"_id":{"type":"string"},"recipient_user_id":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"remind_at":{"type":"string"},"timezone":{"type":"string"},"status":{"type":"string","enum":["scheduled","triggered","cancelled"]},"source_type":{"type":"string","enum":["studio_ai"]},"source_id":{"type":"string"},"triggered_at":{"type":"string"},"cancelled_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","recipient_user_id","title","body","remind_at","timezone","status"]},"CalendarReminderListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/CalendarReminder"}}},"required":["success","data"]},"CalendarReminderCancelSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CalendarReminder"}},"required":["success","data"]},"ProductCategoryInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":1000},"status":{"type":"string","enum":["active","inactive"]}},"required":["name","status"],"additionalProperties":false},"ProductCategoryUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":1000},"status":{"type":"string","enum":["active","inactive"]}},"additionalProperties":false},"StockAdjustmentInput":{"type":"object","properties":{"quantity_delta":{"type":"integer","minimum":-1000000,"maximum":1000000}},"required":["quantity_delta"],"additionalProperties":false},"ProductCategory":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]}},"required":["_id","name","status"]},"ProductCategorySuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]}},"required":["_id","name","status"]}},"required":["success","data"]},"ProductCategoryListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]}},"required":["_id","name","status"]}}},"required":["success","data"]},"ProductCategoryArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"category_id":{"type":"string"}},"required":["category_id"]}},"required":["success","data"]},"Product":{"type":"object","properties":{"_id":{"type":"string"},"category_ids":{"type":"array","items":{"type":"string"}},"name":{"type":"string"},"description":{"type":"string"},"currency":{"type":"string"},"product_type":{"type":"string","enum":["physical","service","digital"]},"track_stock":{"type":"boolean"},"status":{"type":"string","enum":["active","inactive"]},"available_for_assistant":{"type":"boolean"},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string","format":"uri"},"content_type":{"type":"string","enum":["image/jpeg","image/png"]},"alt_text":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","url","content_type","alt_text","position"]}},"option_definitions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"display_type":{"default":"text","type":"string","enum":["text","color"]},"values":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"swatch":{"type":"string","maxLength":40}},"required":["key","label"],"additionalProperties":false}}},"required":["key","label","values"],"additionalProperties":false}},"variants":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"sku":{"type":"string"},"option_values":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"}},"name":{"type":"string"},"unit_price":{"type":"number","minimum":0,"multipleOf":0.01},"available_stock":{"nullable":true,"type":"integer","minimum":0,"maximum":1000000},"status":{"type":"string","enum":["active","inactive"]},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string","format":"uri"},"content_type":{"type":"string","enum":["image/jpeg","image/png"]},"alt_text":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","url","content_type","alt_text","position"]}}},"required":["_id","sku","option_values","name","unit_price","available_stock","status","images"]}},"price_min":{"type":"number","minimum":0,"multipleOf":0.01},"price_max":{"type":"number","minimum":0,"multipleOf":0.01},"available_stock":{"nullable":true,"type":"integer","minimum":0,"maximum":1000000}},"required":["_id","category_ids","name","currency","product_type","track_stock","status","available_for_assistant","images","option_definitions","variants","price_min","price_max","available_stock"]},"ProductInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":1000},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"product_type":{"type":"string","enum":["physical","service","digital"]},"track_stock":{"type":"boolean"},"status":{"type":"string","enum":["active","inactive"]},"available_for_assistant":{"default":true,"type":"boolean"},"category_ids":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"option_definitions":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"display_type":{"default":"text","type":"string","enum":["text","color"]},"values":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"swatch":{"type":"string","maxLength":40}},"required":["key","label"],"additionalProperties":false}}},"required":["key","label","values"],"additionalProperties":false}},"variants":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"sku":{"type":"string","minLength":1,"maxLength":80},"option_values":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"}},"unit_price":{"type":"number","minimum":0,"multipleOf":0.01},"available_stock":{"nullable":true,"type":"integer","minimum":0,"maximum":1000000},"status":{"type":"string","enum":["active","inactive"]}},"required":["sku","option_values","unit_price","available_stock","status"],"additionalProperties":false}}},"required":["name","currency","product_type","track_stock","status","option_definitions","variants"],"additionalProperties":false},"ProductImageUploadInput":{"type":"object","properties":{"content_type":{"type":"string","enum":["image/jpeg","image/png"]},"data_base64":{"type":"string","minLength":4,"maxLength":7000000},"alt_text":{"type":"string","minLength":1,"maxLength":160}},"required":["content_type","data_base64","alt_text"],"additionalProperties":false},"ProductImageOrderInput":{"type":"object","properties":{"image_ids":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["image_ids"],"additionalProperties":false},"ProductUpdateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":1000},"product_type":{"type":"string","enum":["physical","service","digital"]},"track_stock":{"type":"boolean"},"status":{"type":"string","enum":["active","inactive"]},"available_for_assistant":{"type":"boolean"},"category_ids":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"option_definitions":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"display_type":{"default":"text","type":"string","enum":["text","color"]},"values":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"swatch":{"type":"string","maxLength":40}},"required":["key","label"],"additionalProperties":false}}},"required":["key","label","values"],"additionalProperties":false}},"variants":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"sku":{"type":"string","minLength":1,"maxLength":80},"option_values":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"}},"unit_price":{"type":"number","minimum":0,"multipleOf":0.01},"available_stock":{"nullable":true,"type":"integer","minimum":0,"maximum":1000000},"status":{"type":"string","enum":["active","inactive"]},"_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["sku","option_values","unit_price","available_stock","status","_id"],"additionalProperties":false}}},"additionalProperties":false},"ProductVariantInput":{"type":"object","properties":{"sku":{"type":"string","minLength":1,"maxLength":80},"option_values":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"}},"unit_price":{"type":"number","minimum":0,"multipleOf":0.01},"available_stock":{"nullable":true,"type":"integer","minimum":0,"maximum":1000000},"status":{"type":"string","enum":["active","inactive"]}},"required":["sku","option_values","unit_price","available_stock","status"],"additionalProperties":false},"ProductVariantUpdateInput":{"type":"object","properties":{"sku":{"type":"string","minLength":1,"maxLength":80},"option_values":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"}},"unit_price":{"type":"number","minimum":0,"multipleOf":0.01},"status":{"type":"string","enum":["active","inactive"]}},"additionalProperties":false},"ProductSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"category_ids":{"type":"array","items":{"type":"string"}},"name":{"type":"string"},"description":{"type":"string"},"currency":{"type":"string"},"product_type":{"type":"string","enum":["physical","service","digital"]},"track_stock":{"type":"boolean"},"status":{"type":"string","enum":["active","inactive"]},"available_for_assistant":{"type":"boolean"},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string","format":"uri"},"content_type":{"type":"string","enum":["image/jpeg","image/png"]},"alt_text":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","url","content_type","alt_text","position"]}},"option_definitions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"display_type":{"default":"text","type":"string","enum":["text","color"]},"values":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"swatch":{"type":"string","maxLength":40}},"required":["key","label"],"additionalProperties":false}}},"required":["key","label","values"],"additionalProperties":false}},"variants":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"sku":{"type":"string"},"option_values":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"}},"name":{"type":"string"},"unit_price":{"type":"number","minimum":0,"multipleOf":0.01},"available_stock":{"nullable":true,"type":"integer","minimum":0,"maximum":1000000},"status":{"type":"string","enum":["active","inactive"]},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string","format":"uri"},"content_type":{"type":"string","enum":["image/jpeg","image/png"]},"alt_text":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","url","content_type","alt_text","position"]}}},"required":["_id","sku","option_values","name","unit_price","available_stock","status","images"]}},"price_min":{"type":"number","minimum":0,"multipleOf":0.01},"price_max":{"type":"number","minimum":0,"multipleOf":0.01},"available_stock":{"nullable":true,"type":"integer","minimum":0,"maximum":1000000}},"required":["_id","category_ids","name","currency","product_type","track_stock","status","available_for_assistant","images","option_definitions","variants","price_min","price_max","available_stock"]}},"required":["success","data"]},"ProductListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"category_ids":{"type":"array","items":{"type":"string"}},"name":{"type":"string"},"description":{"type":"string"},"currency":{"type":"string"},"product_type":{"type":"string","enum":["physical","service","digital"]},"track_stock":{"type":"boolean"},"status":{"type":"string","enum":["active","inactive"]},"available_for_assistant":{"type":"boolean"},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string","format":"uri"},"content_type":{"type":"string","enum":["image/jpeg","image/png"]},"alt_text":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","url","content_type","alt_text","position"]}},"option_definitions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"display_type":{"default":"text","type":"string","enum":["text","color"]},"values":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":80},"swatch":{"type":"string","maxLength":40}},"required":["key","label"],"additionalProperties":false}}},"required":["key","label","values"],"additionalProperties":false}},"variants":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"sku":{"type":"string"},"option_values":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"}},"name":{"type":"string"},"unit_price":{"type":"number","minimum":0,"multipleOf":0.01},"available_stock":{"nullable":true,"type":"integer","minimum":0,"maximum":1000000},"status":{"type":"string","enum":["active","inactive"]},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string","format":"uri"},"content_type":{"type":"string","enum":["image/jpeg","image/png"]},"alt_text":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","url","content_type","alt_text","position"]}}},"required":["_id","sku","option_values","name","unit_price","available_stock","status","images"]}},"price_min":{"type":"number","minimum":0,"multipleOf":0.01},"price_max":{"type":"number","minimum":0,"multipleOf":0.01},"available_stock":{"nullable":true,"type":"integer","minimum":0,"maximum":1000000}},"required":["_id","category_ids","name","currency","product_type","track_stock","status","available_for_assistant","images","option_definitions","variants","price_min","price_max","available_stock"]}}},"required":["success","data"]},"ProductArchiveSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"product_id":{"type":"string"}},"required":["product_id"]}},"required":["success","data"]},"WorkspaceTemplateVariable":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64},"label":{"type":"string","minLength":1,"maxLength":100},"required":{"default":false,"type":"boolean"}},"required":["key","label"],"additionalProperties":false},"WorkspaceTemplateInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"kind":{"type":"string","enum":["message","notification"]},"body":{"type":"string","minLength":1,"maxLength":4096},"variables":{"default":[],"maxItems":30,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64},"label":{"type":"string","minLength":1,"maxLength":100},"required":{"default":false,"type":"boolean"}},"required":["key","label"],"additionalProperties":false}},"idempotency_key":{"type":"string","minLength":1,"maxLength":160}},"required":["name","kind","body","idempotency_key"],"additionalProperties":false},"WorkspaceTemplateUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"kind":{"type":"string","enum":["message","notification"]},"body":{"type":"string","minLength":1,"maxLength":4096},"variables":{"default":[],"maxItems":30,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64},"label":{"type":"string","minLength":1,"maxLength":100},"required":{"default":false,"type":"boolean"}},"required":["key","label"],"additionalProperties":false}}},"required":["name","kind","body"],"additionalProperties":false},"WorkspaceTemplate":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["message","notification"]},"body":{"type":"string"},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64},"label":{"type":"string","minLength":1,"maxLength":100},"required":{"default":false,"type":"boolean"}},"required":["key","label"],"additionalProperties":false}},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","kind","body","variables","version"]},"NotificationDeviceInput":{"type":"object","properties":{"installation_id":{"type":"string","minLength":1,"maxLength":160},"token":{"type":"string","minLength":20,"maxLength":4096},"platform":{"type":"string","enum":["web","android","ios"]}},"required":["installation_id","token","platform"],"additionalProperties":false},"NotificationCreateInput":{"type":"object","properties":{"user_ids":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string"}},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":1024},"category":{"type":"string","minLength":1,"maxLength":80},"action_url":{"type":"string","maxLength":2048},"data":{"type":"object","additionalProperties":{"type":"string"}},"idempotency_key":{"type":"string","minLength":1,"maxLength":160}},"required":["user_ids","title","body","category","idempotency_key"],"additionalProperties":false},"Notification":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"category":{"type":"string"},"action_url":{"type":"string"},"data":{"type":"object","additionalProperties":{"type":"string"}},"read_at":{"type":"string"},"deliveries_total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"deliveries_sent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"deliveries_failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_at":{"type":"string"}},"required":["_id","title","body","category","data","deliveries_total","deliveries_sent","deliveries_failed"]},"StudioAiSessionCreateInput":{"type":"object","properties":{"purpose":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9._-]*$"},"idempotency_key":{"type":"string","minLength":1,"maxLength":160}},"required":["purpose","idempotency_key"],"additionalProperties":false},"StudioAiSession":{"type":"object","properties":{"_id":{"type":"string"},"purpose":{"type":"string"},"title":{"type":"string"},"turn_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_message_at":{"type":"string"},"status":{"type":"string","enum":["active","closed"]},"retention_expires_at":{"type":"string"},"closed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","purpose","title","turn_count","status","retention_expires_at"]},"StudioAiSessionSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string"},"purpose":{"type":"string"},"title":{"type":"string"},"turn_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_message_at":{"type":"string"},"status":{"type":"string","enum":["active","closed"]},"retention_expires_at":{"type":"string"},"closed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","purpose","title","turn_count","status","retention_expires_at"]}},"required":["success","data"]},"StudioAiSessionListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"purpose":{"type":"string"},"title":{"type":"string"},"turn_count":{"type":"integer","minimum":0,"maximum":9007199254740991},"last_message_at":{"type":"string"},"status":{"type":"string","enum":["active","closed"]},"retention_expires_at":{"type":"string"},"closed_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","purpose","title","turn_count","status","retention_expires_at"]}}},"required":["success","data"]},"StudioAiAccess":{"type":"object","properties":{"state":{"type":"string","enum":["available","entitlement_missing","tool_disabled","permission_denied","quota_exhausted"]},"can_use":{"type":"boolean"},"message":{"type":"string"}},"required":["state","can_use","message"]},"StudioAiAccessSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"state":{"type":"string","enum":["available","entitlement_missing","tool_disabled","permission_denied","quota_exhausted"]},"can_use":{"type":"boolean"},"message":{"type":"string"}},"required":["state","can_use","message"]}},"required":["success","data"]},"StudioAiMetricsSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"summary":{"type":"object","properties":{"runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"successful_runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"fallback_runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"input_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"cached_input_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"output_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"reasoning_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"total_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"tool_calls":{"type":"integer","minimum":0,"maximum":9007199254740991},"latency_ms":{"type":"number","minimum":0},"estimated_cost_microusd":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["runs","successful_runs","fallback_runs","input_tokens","cached_input_tokens","output_tokens","reasoning_tokens","total_tokens","tool_calls","latency_ms","estimated_cost_microusd"]},"by_purpose":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"successful_runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"fallback_runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"total_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"estimated_cost_microusd":{"type":"integer","minimum":0,"maximum":9007199254740991},"average_latency_ms":{"type":"number","minimum":0}},"required":["value","runs","successful_runs","fallback_runs","total_tokens","estimated_cost_microusd","average_latency_ms"]}},"by_model_profile":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"successful_runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"fallback_runs":{"type":"integer","minimum":0,"maximum":9007199254740991},"total_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"estimated_cost_microusd":{"type":"integer","minimum":0,"maximum":9007199254740991},"average_latency_ms":{"type":"number","minimum":0},"model":{"type":"string"},"profile":{"type":"string"}},"required":["value","runs","successful_runs","fallback_runs","total_tokens","estimated_cost_microusd","average_latency_ms","model","profile"]}},"by_result":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"runs":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["value","runs"]}},"by_tool":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"calls":{"type":"integer","minimum":0,"maximum":9007199254740991},"completed":{"type":"integer","minimum":0,"maximum":9007199254740991},"denied":{"type":"integer","minimum":0,"maximum":9007199254740991},"failed":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["name","calls","completed","denied","failed"]}}},"required":["summary","by_purpose","by_model_profile","by_result","by_tool"]}},"required":["success","data"]},"StudioAiConversationSource":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","enum":["scope","workspace_tools","permissions"]}},"required":["id","label","kind"]},"StudioAiTurnCreateInput":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":4000},"idempotency_key":{"type":"string","minLength":1,"maxLength":160}},"required":["message","idempotency_key"],"additionalProperties":false},"StudioAiConversationTurn":{"type":"object","properties":{"_id":{"type":"string"},"session_id":{"type":"string"},"user_message":{"type":"string"},"assistant_message":{"type":"string"},"plan":{"type":"array","items":{"type":"string"}},"suggested_questions":{"type":"array","items":{"type":"string"}},"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","enum":["scope","workspace_tools","permissions"]}},"required":["id","label","kind"]}},"tools_used":{"type":"array","items":{"type":"string"}},"availability":{"type":"string","enum":["available","provider_unavailable","timeout","limit_reached","invalid_response","permission_denied"]},"run_id":{"type":"string"},"proposal_ids":{"type":"array","items":{"type":"string"}},"error_code":{"type":"string"},"retryable":{"type":"boolean"},"created_at":{"type":"string"},"completed_at":{"type":"string"}},"required":["_id","session_id","user_message","assistant_message","plan","suggested_questions","sources","tools_used","availability","run_id","proposal_ids","created_at","completed_at"]},"StudioAiConversationTurnSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string"},"session_id":{"type":"string"},"user_message":{"type":"string"},"assistant_message":{"type":"string"},"plan":{"type":"array","items":{"type":"string"}},"suggested_questions":{"type":"array","items":{"type":"string"}},"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","enum":["scope","workspace_tools","permissions"]}},"required":["id","label","kind"]}},"tools_used":{"type":"array","items":{"type":"string"}},"availability":{"type":"string","enum":["available","provider_unavailable","timeout","limit_reached","invalid_response","permission_denied"]},"run_id":{"type":"string"},"proposal_ids":{"type":"array","items":{"type":"string"}},"error_code":{"type":"string"},"retryable":{"type":"boolean"},"created_at":{"type":"string"},"completed_at":{"type":"string"}},"required":["_id","session_id","user_message","assistant_message","plan","suggested_questions","sources","tools_used","availability","run_id","proposal_ids","created_at","completed_at"]}},"required":["success","data"]},"StudioAiConversationTurnListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"session_id":{"type":"string"},"user_message":{"type":"string"},"assistant_message":{"type":"string"},"plan":{"type":"array","items":{"type":"string"}},"suggested_questions":{"type":"array","items":{"type":"string"}},"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","enum":["scope","workspace_tools","permissions"]}},"required":["id","label","kind"]}},"tools_used":{"type":"array","items":{"type":"string"}},"availability":{"type":"string","enum":["available","provider_unavailable","timeout","limit_reached","invalid_response","permission_denied"]},"run_id":{"type":"string"},"proposal_ids":{"type":"array","items":{"type":"string"}},"error_code":{"type":"string"},"retryable":{"type":"boolean"},"created_at":{"type":"string"},"completed_at":{"type":"string"}},"required":["_id","session_id","user_message","assistant_message","plan","suggested_questions","sources","tools_used","availability","run_id","proposal_ids","created_at","completed_at"]}}},"required":["success","data"]},"StudioAiActionProposalCreateInput":{"type":"object","properties":{"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["contact.create"]},"contact":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","maxLength":320,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","minLength":6,"maxLength":32},"phone_country_code":{"type":"string","minLength":2,"maxLength":2},"document_type":{"type":"string","minLength":1,"maxLength":40},"document_number":{"type":"string","minLength":1,"maxLength":80}},"required":["name"],"additionalProperties":false}},"required":["type","contact"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["case.create"]},"contact":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","maxLength":320,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","minLength":6,"maxLength":32},"phone_country_code":{"type":"string","minLength":2,"maxLength":2}},"required":["name"],"additionalProperties":false},"case":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"type_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"state_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["title"],"additionalProperties":false}},"required":["type","contact","case"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["message.send"]},"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"message":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"maxLength":4096}},"required":["kind","text"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["template"]},"template_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"parameters":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024}}},"required":["kind","template_id","parameters"],"additionalProperties":false}]}},"required":["type","contact_id","message"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reminder.create"]},"recipient":{"type":"object","properties":{"kind":{"type":"string","enum":["current_user"]}},"required":["kind"],"additionalProperties":false},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"remind_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"timezone":{"type":"string","minLength":1,"maxLength":120}},"required":["type","recipient","title","body","remind_at","timezone"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["followup.create"]},"recipient":{"type":"object","properties":{"kind":{"type":"string","enum":["current_user"]}},"required":["kind"],"additionalProperties":false},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"title":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":2000},"schedule":{"type":"string","minLength":1,"maxLength":120},"timezone":{"type":"string","minLength":1,"maxLength":120},"max_occurrences":{"type":"integer","minimum":1,"maximum":10000},"exit":{"type":"object","properties":{"event_type":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*$"},"conditions":{"type":"object","properties":{"kind":{"type":"string","enum":["predicate"]},"field":{"type":"string","pattern":"^(event|data|metadata)(\\.[A-Za-z0-9_]+)+$"},"operator":{"type":"string","enum":["equals","not_equals","in","not_in","exists","not_exists","contains","greater_than","greater_than_or_equal","less_than","less_than_or_equal"]},"value":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"type":"string","nullable":true,"enum":[null]},{"maxItems":100,"type":"array","items":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"type":"string","nullable":true,"enum":[null]}]}}]}},"required":["kind","field","operator"],"additionalProperties":false}},"required":["event_type"],"additionalProperties":false}},"required":["type","recipient","name","title","body","schedule","timezone","max_occurrences","exit"],"additionalProperties":false}]},"idempotency_key":{"type":"string","minLength":1,"maxLength":200}},"required":["action","idempotency_key"],"additionalProperties":false},"StudioAiActionProposalApproveInput":{"type":"object","properties":{"expected_fingerprint":{"type":"string","pattern":"^[a-f0-9]{64}$"},"idempotency_key":{"type":"string","minLength":1,"maxLength":200}},"required":["expected_fingerprint","idempotency_key"],"additionalProperties":false},"StudioAiActionProposalPreview":{"type":"object","properties":{"title":{"type":"string"},"summary":{"type":"string"},"recipient":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"detail":{"type":"string"}},"required":["label"]},"channel":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"}},"required":["label"]},"content":{"type":"object","properties":{"kind":{"type":"string","enum":["contact","case","text","template","reminder","followup"]},"text":{"type":"string"}},"required":["kind","text"]},"restrictions":{"type":"array","items":{"type":"string"}},"impact":{"type":"string"}},"required":["title","summary","restrictions","impact"]},"StudioAiActionProposal":{"type":"object","properties":{"_id":{"type":"string"},"session_id":{"type":"string"},"action_type":{"type":"string","enum":["contact.create","case.create","message.send","reminder.create","followup.create"]},"preview":{"type":"object","properties":{"title":{"type":"string"},"summary":{"type":"string"},"recipient":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"detail":{"type":"string"}},"required":["label"]},"channel":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"}},"required":["label"]},"content":{"type":"object","properties":{"kind":{"type":"string","enum":["contact","case","text","template","reminder","followup"]},"text":{"type":"string"}},"required":["kind","text"]},"restrictions":{"type":"array","items":{"type":"string"}},"impact":{"type":"string"}},"required":["title","summary","restrictions","impact"]},"approval_fingerprint":{"type":"string"},"status":{"type":"string","enum":["proposed","awaiting_approval","approved","executing","completed","failed","cancelled","expired"]},"expires_at":{"type":"string"},"result":{"type":"object","properties":{"resource_type":{"type":"string","enum":["contact","case","message","calendar_reminder","automation"]},"resource_id":{"type":"string"},"secondary_id":{"type":"string"}},"required":["resource_type","resource_id"]},"error_code":{"type":"string"},"retryable":{"type":"boolean"},"created_at":{"type":"string"},"approved_at":{"type":"string"},"completed_at":{"type":"string"}},"required":["_id","session_id","action_type","preview","approval_fingerprint","status","expires_at","created_at"]},"StudioAiActionProposalSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"_id":{"type":"string"},"session_id":{"type":"string"},"action_type":{"type":"string","enum":["contact.create","case.create","message.send","reminder.create","followup.create"]},"preview":{"type":"object","properties":{"title":{"type":"string"},"summary":{"type":"string"},"recipient":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"detail":{"type":"string"}},"required":["label"]},"channel":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"}},"required":["label"]},"content":{"type":"object","properties":{"kind":{"type":"string","enum":["contact","case","text","template","reminder","followup"]},"text":{"type":"string"}},"required":["kind","text"]},"restrictions":{"type":"array","items":{"type":"string"}},"impact":{"type":"string"}},"required":["title","summary","restrictions","impact"]},"approval_fingerprint":{"type":"string"},"status":{"type":"string","enum":["proposed","awaiting_approval","approved","executing","completed","failed","cancelled","expired"]},"expires_at":{"type":"string"},"result":{"type":"object","properties":{"resource_type":{"type":"string","enum":["contact","case","message","calendar_reminder","automation"]},"resource_id":{"type":"string"},"secondary_id":{"type":"string"}},"required":["resource_type","resource_id"]},"error_code":{"type":"string"},"retryable":{"type":"boolean"},"created_at":{"type":"string"},"approved_at":{"type":"string"},"completed_at":{"type":"string"}},"required":["_id","session_id","action_type","preview","approval_fingerprint","status","expires_at","created_at"]}},"required":["success","data"]},"StudioAiActionProposalListSuccess":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"session_id":{"type":"string"},"action_type":{"type":"string","enum":["contact.create","case.create","message.send","reminder.create","followup.create"]},"preview":{"type":"object","properties":{"title":{"type":"string"},"summary":{"type":"string"},"recipient":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"detail":{"type":"string"}},"required":["label"]},"channel":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"}},"required":["label"]},"content":{"type":"object","properties":{"kind":{"type":"string","enum":["contact","case","text","template","reminder","followup"]},"text":{"type":"string"}},"required":["kind","text"]},"restrictions":{"type":"array","items":{"type":"string"}},"impact":{"type":"string"}},"required":["title","summary","restrictions","impact"]},"approval_fingerprint":{"type":"string"},"status":{"type":"string","enum":["proposed","awaiting_approval","approved","executing","completed","failed","cancelled","expired"]},"expires_at":{"type":"string"},"result":{"type":"object","properties":{"resource_type":{"type":"string","enum":["contact","case","message","calendar_reminder","automation"]},"resource_id":{"type":"string"},"secondary_id":{"type":"string"}},"required":["resource_type","resource_id"]},"error_code":{"type":"string"},"retryable":{"type":"boolean"},"created_at":{"type":"string"},"approved_at":{"type":"string"},"completed_at":{"type":"string"}},"required":["_id","session_id","action_type","preview","approval_fingerprint","status","expires_at","created_at"]}}},"required":["success","data"]},"BroadcastInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"whatsapp_template_binding_id":{"type":"string"},"audience_segment_id":{"type":"string"},"scheduled_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["name","whatsapp_template_binding_id","audience_segment_id"],"additionalProperties":false},"Broadcast":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"channel":{"type":"string","enum":["whatsapp"]},"template_kind":{"type":"string","enum":["whatsapp_meta"]},"whatsapp_template_binding_id":{"type":"string"},"workspace_channel_id":{"type":"string"},"whatsapp_template":{"type":"object","properties":{"external_template_id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string"},"parameter_keys":{"type":"array","items":{"type":"string"}}},"required":["external_template_id","name","language","category","parameter_keys"]},"audience_segment_id":{"type":"string"},"audience_snapshot":{"type":"object","properties":{"segment_id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false}},"required":["segment_id","name","source","granularity","revision","definition"]},"status":{"type":"string","enum":["draft","scheduled","running","completed","cancelled","failed"]},"audience_estimated_at":{"type":"string"},"scheduled_at":{"type":"string"},"started_at":{"type":"string"},"completed_at":{"type":"string"},"cancelled_at":{"type":"string"},"metrics":{"type":"object","properties":{"selected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"eligible":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"excluded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"excluded_by_reason":{"type":"object","additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"queued":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"delivered":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"read":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"responded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"cases":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"orders":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"coupons_paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"converted_amount":{"type":"number"}},"required":["selected","eligible","excluded","excluded_by_reason","queued","sent","delivered","read","skipped","failed","responded","cases","orders","coupons_paid","converted_amount"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","channel","template_kind","whatsapp_template_binding_id","workspace_channel_id","whatsapp_template","audience_segment_id","audience_snapshot","status","metrics"]},"AudienceCatalog":{"type":"object","properties":{"sources":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"label":{"type":"string"},"granularities":{"type":"array","items":{"type":"string","enum":["per_contact","per_record"]}},"context_keys":{"type":"array","items":{"type":"string"}}},"required":["key","label","granularities","context_keys"]}},"fields":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["string","number","date","boolean","identifier"]},"operators":{"type":"array","items":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]}},"options":{"type":"array","items":{"type":"object","properties":{"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"label":{"type":"string"}},"required":["value","label"]}}},"required":["source","key","label","type","operators"]}},"limits":{"type":"object","properties":{"max_rules":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max_values_per_rule":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max_sample_size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["max_rules","max_values_per_rule","max_sample_size"]}},"required":["sources","fields","limits"]},"AudienceCatalogSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"sources":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"label":{"type":"string"},"granularities":{"type":"array","items":{"type":"string","enum":["per_contact","per_record"]}},"context_keys":{"type":"array","items":{"type":"string"}}},"required":["key","label","granularities","context_keys"]}},"fields":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["string","number","date","boolean","identifier"]},"operators":{"type":"array","items":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]}},"options":{"type":"array","items":{"type":"object","properties":{"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"label":{"type":"string"}},"required":["value","label"]}}},"required":["source","key","label","type","operators"]}},"limits":{"type":"object","properties":{"max_rules":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max_values_per_rule":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max_sample_size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["max_rules","max_values_per_rule","max_sample_size"]}},"required":["sources","fields","limits"]}},"required":["success","data"]},"AudienceDefinition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false},"AudiencePreviewInput":{"type":"object","properties":{"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false},"sample_size":{"type":"integer","minimum":1,"maximum":20}},"required":["source","granularity","definition"],"additionalProperties":false},"AudiencePreview":{"type":"object","properties":{"selected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"excluded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sample":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"document_number":{"type":"string"}},"required":["_id","name"]}}},"required":["selected","total","excluded","sample"]},"AudienceSegmentInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false},"status":{"type":"string","enum":["active","inactive"]}},"required":["name","source","granularity","definition"],"additionalProperties":false},"AudienceSegmentUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false},"status":{"type":"string","enum":["active","inactive"]},"expected_revision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":9007199254740991}},"required":["name","source","granularity","definition","expected_revision"],"additionalProperties":false},"AudienceSegment":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false},"status":{"type":"string","enum":["active","inactive"]},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","source","granularity","definition","status","revision"]},"AudienceSegmentSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false},"status":{"type":"string","enum":["active","inactive"]},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","source","granularity","definition","status","revision"]}},"required":["success","data"]},"AudienceSegmentListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false},"status":{"type":"string","enum":["active","inactive"]},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","source","granularity","definition","status","revision"]}}},"required":["success","data"]},"AudienceSegmentSnapshot":{"type":"object","properties":{"segment_id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false}},"required":["segment_id","name","source","granularity","revision","definition"]},"AudiencePreviewSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"selected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"excluded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sample":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"document_number":{"type":"string"}},"required":["_id","name"]}}},"required":["selected","total","excluded","sample"]}},"required":["success","data"]},"AudienceOperationInput":{"type":"object","properties":{"segment_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"action":{"type":"string","enum":["add_tags","remove_tags","export_contacts","assign_records"]},"tag_ids":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"assigned_user_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"confirmed":{"type":"boolean","enum":[true]},"idempotency_key":{"type":"string","minLength":8,"maxLength":160}},"required":["segment_id","action","confirmed","idempotency_key"],"additionalProperties":false},"AudienceOperation":{"type":"object","properties":{"_id":{"type":"string"},"segment_snapshot":{"type":"object","properties":{"segment_id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false}},"required":["segment_id","name","source","granularity","revision","definition"]},"action":{"type":"string","enum":["add_tags","remove_tags","export_contacts","assign_records"]},"parameters":{"type":"object","properties":{"tag_ids":{"type":"array","items":{"type":"string"}},"assigned_user_id":{"type":"string"}}},"status":{"type":"string","enum":["completed","failed"]},"selected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"affected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"excluded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failures":{"type":"array","items":{"type":"object","properties":{"source_id":{"type":"string"},"reason":{"type":"string"}},"required":["source_id","reason"]}},"export_rows":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"document_number":{"type":"string"}},"required":["name"]}},"idempotency_key":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","segment_snapshot","action","parameters","status","selected","affected","excluded","failures","idempotency_key"]},"AudienceOperationSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"segment_snapshot":{"type":"object","properties":{"segment_id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false}},"required":["segment_id","name","source","granularity","revision","definition"]},"action":{"type":"string","enum":["add_tags","remove_tags","export_contacts","assign_records"]},"parameters":{"type":"object","properties":{"tag_ids":{"type":"array","items":{"type":"string"}},"assigned_user_id":{"type":"string"}}},"status":{"type":"string","enum":["completed","failed"]},"selected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"affected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"excluded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failures":{"type":"array","items":{"type":"object","properties":{"source_id":{"type":"string"},"reason":{"type":"string"}},"required":["source_id","reason"]}},"export_rows":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"document_number":{"type":"string"}},"required":["name"]}},"idempotency_key":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","segment_snapshot","action","parameters","status","selected","affected","excluded","failures","idempotency_key"]}},"required":["success","data"]},"AudienceOperationListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"segment_snapshot":{"type":"object","properties":{"segment_id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"granularity":{"type":"string","enum":["per_contact","per_record"]},"revision":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"definition":{"type":"object","properties":{"combinator":{"type":"string","enum":["all","any"]},"rules":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":80},"operator":{"type":"string","enum":["eq","neq","in","not_in","contains","starts_with","gt","gte","lt","lte","between","exists","is_true","is_false"]},"value":{"anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"maxItems":100,"type":"array","items":{"type":"string","maxLength":200}},{"maxItems":100,"type":"array","items":{"type":"number"}}]}},"required":["field","operator"],"additionalProperties":false}}},"required":["combinator","rules"],"additionalProperties":false}},"required":["segment_id","name","source","granularity","revision","definition"]},"action":{"type":"string","enum":["add_tags","remove_tags","export_contacts","assign_records"]},"parameters":{"type":"object","properties":{"tag_ids":{"type":"array","items":{"type":"string"}},"assigned_user_id":{"type":"string"}}},"status":{"type":"string","enum":["completed","failed"]},"selected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"affected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"excluded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failures":{"type":"array","items":{"type":"object","properties":{"source_id":{"type":"string"},"reason":{"type":"string"}},"required":["source_id","reason"]}},"export_rows":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"document_number":{"type":"string"}},"required":["name"]}},"idempotency_key":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","segment_snapshot","action","parameters","status","selected","affected","excluded","failures","idempotency_key"]}}},"required":["success","data"]},"AudienceImportInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"rows":{"minItems":1,"maxItems":1000,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"phone":{"type":"string","minLength":6,"maxLength":32},"phone_country_code":{"type":"string","minLength":2,"maxLength":2},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"document_type":{"type":"string","minLength":1,"maxLength":20},"document_number":{"type":"string","minLength":1,"maxLength":32}},"required":["name"],"additionalProperties":false}}},"required":["name","rows"],"additionalProperties":false},"AudienceImport":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["processing","completed","failed"]},"total_rows":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_contacts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"updated_contacts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed_rows":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"segment_id":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","name","status","total_rows","created_contacts","updated_contacts","failed_rows"]},"AudienceImportSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["processing","completed","failed"]},"total_rows":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_contacts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"updated_contacts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed_rows":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"segment_id":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","name","status","total_rows","created_contacts","updated_contacts","failed_rows"]}},"required":["success","data"]},"AudienceImportListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["processing","completed","failed"]},"total_rows":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_contacts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"updated_contacts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed_rows":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"segment_id":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","name","status","total_rows","created_contacts","updated_contacts","failed_rows"]}}},"required":["success","data"]},"BroadcastSuppressionInput":{"type":"object","properties":{"contact_id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"reason":{"type":"string","minLength":1,"maxLength":200}},"required":["contact_id","reason"],"additionalProperties":false},"BroadcastSuppression":{"type":"object","properties":{"_id":{"type":"string"},"contact_id":{"type":"string"},"reason":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","contact_id","reason"]},"BroadcastSuppressionSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"contact_id":{"type":"string"},"reason":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","contact_id","reason"]}},"required":["success","data"]},"BroadcastSuppressionListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"contact_id":{"type":"string"},"reason":{"type":"string"},"created_at":{"type":"string"}},"required":["_id","contact_id","reason"]}}},"required":["success","data"]},"AcquisitionCampaignMetric":{"type":"object","properties":{"key":{"type":"string"},"source":{"type":"string","enum":["direct","organic","paid","referral","social","email","partner","offline","other"]},"campaign":{"type":"string"},"external_campaign_ref":{"type":"string"},"cases":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"won":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lost":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"value":{"type":"number"},"breakdown":{"type":"array","items":{"type":"object","properties":{"type_id":{"type":"string"},"type":{"type":"string"},"state_id":{"type":"string"},"state":{"type":"string"},"outcome":{"type":"string","enum":["open","won","lost"]},"cases":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"value":{"type":"number"}},"required":["type_id","type","state_id","state","outcome","cases","value"]}}},"required":["key","source","cases","open","won","lost","value","breakdown"]},"AcquisitionCampaignMetricListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"source":{"type":"string","enum":["direct","organic","paid","referral","social","email","partner","offline","other"]},"campaign":{"type":"string"},"external_campaign_ref":{"type":"string"},"cases":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"won":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lost":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"value":{"type":"number"},"breakdown":{"type":"array","items":{"type":"object","properties":{"type_id":{"type":"string"},"type":{"type":"string"},"state_id":{"type":"string"},"state":{"type":"string"},"outcome":{"type":"string","enum":["open","won","lost"]},"cases":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"value":{"type":"number"}},"required":["type_id","type","state_id","state","outcome","cases","value"]}}},"required":["key","source","cases","open","won","lost","value","breakdown"]}}},"required":["success","data"]},"BroadcastRecipient":{"type":"object","properties":{"_id":{"type":"string"},"contact_id":{"type":"string"},"source_type":{"type":"string","enum":["persons","cases","orders","payment_coupons","receivables","imports"]},"source_id":{"type":"string"},"status":{"type":"string","enum":["pending","queued","excluded","skipped","failed"]},"message_id":{"type":"string"},"delivery_status":{"type":"string","enum":["queued","sent","delivered","read","failed"]},"exclusion_reason":{"type":"string"},"context_snapshot":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}},"parameter_values":{"type":"object","additionalProperties":{"type":"string"}},"error_code":{"type":"string"},"queued_at":{"type":"string"},"sent_at":{"type":"string"},"delivered_at":{"type":"string"},"read_at":{"type":"string"},"responded_at":{"type":"string"},"case_ids":{"type":"array","items":{"type":"string"}},"order_ids":{"type":"array","items":{"type":"string"}},"payment_coupon_ids":{"type":"array","items":{"type":"string"}},"converted_amount":{"type":"number"}},"required":["contact_id","source_type","source_id","status","context_snapshot","parameter_values","case_ids","order_ids","payment_coupon_ids","converted_amount"]},"BroadcastDetail":{"type":"object","properties":{"broadcast":{"$ref":"#/components/schemas/Broadcast"},"recipients":{"type":"array","items":{"$ref":"#/components/schemas/BroadcastRecipient"}}},"required":["broadcast","recipients","recipients_estimated"]},"BroadcastSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/Broadcast"}},"required":["success","data"]},"BroadcastListSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Broadcast"}}},"required":["success","data"]},"BroadcastDetailSuccess":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/BroadcastDetail"}},"required":["success","data"]},"WorkspaceToolState":{"type":"object","required":["status","is_enabled"],"properties":{"status":{"type":"string"},"is_enabled":{"type":"boolean"}}},"WorkspaceToolDependency":{"type":"object","required":["tool_id","required_status","reason"],"properties":{"tool_id":{"type":"string"},"required_status":{"type":"string","enum":["enabled"]},"reason":{"type":"string"}}},"WorkspaceToolAvailability":{"type":"object","required":["capability_key","is_available","reason"],"properties":{"capability_key":{"type":"string"},"is_available":{"type":"boolean"},"reason":{"type":"string","enum":["available","business_inactive","subscription_inactive","not_contracted","allocation_exhausted"]},"source":{"type":"string","enum":["plan","override"]},"allocated":{"type":"integer","minimum":0},"allocation_limit":{"type":"integer","minimum":0}}},"WorkspaceTool":{"type":"object","required":["tool_id","name","description","dependencies","state","availability"],"properties":{"tool_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","enum":["foundation","sales","service","products","payments","automation"]},"highlights":{"type":"array","items":{"type":"string"}},"dependencies":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceToolDependency"}},"state":{"$ref":"#/components/schemas/WorkspaceToolState"},"availability":{"$ref":"#/components/schemas/WorkspaceToolAvailability"}}},"WorkspaceToolListSuccess":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceTool"}}}}}},"security":[{"FirebaseBearer":[]}],"paths":{"/integrations/connections":{"get":{"operationId":"listIntegrationConnections","summary":"Listar conexiones externas del negocio","tags":["Integrations"],"responses":{"200":{"description":"Conexiones sin material secreto.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationConnectionListSuccess"}}}}}},"post":{"operationId":"createIntegrationConnection","summary":"Crear conexión externa segura","description":"La credencial se cifra en reposo y nunca se devuelve en claro.","tags":["Integrations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationConnectionCreateInput"}}}},"responses":{"201":{"description":"Conexión creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationConnectionSuccess"}}}},"409":{"description":"Nombre duplicado."}}}},"/integrations/connections/{id}":{"get":{"operationId":"getIntegrationConnection","summary":"Consultar conexión externa","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"}],"responses":{"200":{"description":"Conexión.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationConnectionSuccess"}}}},"404":{"description":"No encontrada."}}},"patch":{"operationId":"updateIntegrationConnection","summary":"Actualizar conexión externa","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationConnectionUpdateInput"}}}},"responses":{"200":{"description":"Conexión actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationConnectionSuccess"}}}},"409":{"description":"Versión obsoleta o nombre duplicado."}}},"delete":{"operationId":"archiveIntegrationConnection","summary":"Archivar conexión externa","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"}],"responses":{"200":{"description":"Conexión archivada."},"409":{"description":"Tiene bindings activos."}}}},"/integrations/connections/{id}/rotate-credential":{"post":{"operationId":"rotateIntegrationCredential","summary":"Rotar credencial de una conexión","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationCredentialRotateInput"}}}},"responses":{"200":{"description":"Credencial rotada sin devolver el secreto.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationConnectionSuccess"}}}},"409":{"description":"Versión obsoleta."}}}},"/integrations/bindings":{"get":{"operationId":"listWorkspaceIntegrationBindings","summary":"Listar conexiones habilitadas en el Workspace","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Bindings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationBindingListSuccess"}}}}}},"post":{"operationId":"createWorkspaceIntegrationBinding","summary":"Habilitar una conexión en el Workspace","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationBindingCreateInput"}}}},"responses":{"201":{"description":"Binding creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationBindingSuccess"}}}},"409":{"description":"La conexión ya está habilitada."}}}},"/integrations/bindings/{id}":{"get":{"operationId":"getWorkspaceIntegrationBinding","summary":"Consultar binding del Workspace","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Binding.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationBindingSuccess"}}}},"404":{"description":"No encontrado."}}},"patch":{"operationId":"updateWorkspaceIntegrationBinding","summary":"Activar o desactivar binding","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationBindingUpdateInput"}}}},"responses":{"200":{"description":"Binding actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationBindingSuccess"}}}},"409":{"description":"Versión obsoleta o conexión inactiva."}}},"delete":{"operationId":"archiveWorkspaceIntegrationBinding","summary":"Archivar binding del Workspace","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Binding archivado."},"409":{"description":"Tiene operaciones configuradas."}}}},"/integrations/operations":{"get":{"operationId":"listIntegrationOperations","summary":"Listar operaciones externas del Workspace","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Operaciones.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationListSuccess"}}}}}},"post":{"operationId":"createIntegrationOperation","summary":"Crear borrador de operación externa","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationInput"}}}},"responses":{"201":{"description":"Operación creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationSuccess"}}}},"409":{"description":"Nombre duplicado."}}}},"/integrations/operations/{id}":{"get":{"operationId":"getIntegrationOperation","summary":"Consultar operación externa","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Operación.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationSuccess"}}}},"404":{"description":"No encontrada."}}},"delete":{"operationId":"archiveIntegrationOperation","summary":"Archivar operación externa","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Operación archivada."},"404":{"description":"No encontrada."}}}},"/integrations/operations/test":{"post":{"operationId":"testIntegrationOperationDraft","summary":"Ejecutar una prueba efímera de un borrador de integración","description":"Ejecuta un único request con el binding autorizado y devuelve una respuesta JSON sanitizada. No crea invocaciones, versiones, retries ni persistencia del body.","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationTestInput"}}}},"responses":{"200":{"description":"Respuesta de prueba efímera.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationTestSuccess"}}}},"404":{"description":"Binding no encontrado dentro del Workspace."},"409":{"description":"Tool o conexión inactiva."},"422":{"description":"Request o confirmación inválidos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationValidationError"}}}},"502":{"description":"Fallo sanitizado de autenticación, destino o transporte sin respuesta HTTP.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationTestFailure"}}}}}}},"/integrations/operations/{id}/draft":{"put":{"operationId":"replaceIntegrationOperationDraft","summary":"Reemplazar borrador de operación externa","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationDraftReplaceInput"}}}},"responses":{"200":{"description":"Borrador actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationSuccess"}}}},"409":{"description":"Revisión obsoleta."}}}},"/integrations/operations/{id}/publish":{"post":{"operationId":"publishIntegrationOperation","summary":"Publicar snapshot inmutable de una operación","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationPublishInput"}}}},"responses":{"201":{"description":"Versión publicada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationVersionSuccess"}}}},"409":{"description":"Revisión obsoleta."},"422":{"description":"Contrato inválido.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationValidationError"}}}}}}},"/integrations/operations/{id}/versions":{"get":{"operationId":"listIntegrationOperationVersions","summary":"Listar snapshots publicados de una operación","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Versiones publicadas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOperationVersionListSuccess"}}}}}}},"/integrations/operations/{id}/invocations":{"post":{"operationId":"createIntegrationInvocation","summary":"Solicitar ejecución durable de una operación publicada","description":"La clave de idempotencia se combina con el scope y la versión publicada. El request externo se ejecuta fuera de la transacción mediante Cloud Tasks.","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInvocationCreateInput"}}}},"responses":{"200":{"description":"Replay idempotente de una invocación existente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInvocationSuccess"}}}},"202":{"description":"Invocación aceptada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInvocationSuccess"}}}},"409":{"description":"Clave de idempotencia reutilizada con un payload distinto."},"422":{"description":"Inputs inválidos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationValidationError"}}}}}}},"/integrations/invocations":{"get":{"operationId":"listIntegrationInvocations","summary":"Listar invocaciones externas sanitizadas","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"status","schema":{"type":"string","enum":["queued","processing","retrying","waiting_provider","succeeded","failed","timed_out","indeterminate"]}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"Invocaciones sin secretos ni payload HTTP crudo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInvocationListSuccess"}}}}}}},"/integrations/invocations/{id}":{"get":{"operationId":"getIntegrationInvocation","summary":"Consultar una invocación externa","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Invocación sanitizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInvocationSuccess"}}}},"404":{"description":"No encontrada dentro del Workspace."}}}},"/integrations/invocations/{id}/attempts":{"get":{"operationId":"listIntegrationInvocationAttempts","summary":"Consultar telemetría sanitizada de intentos","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Intentos sin request, response ni credenciales.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInvocationAttemptListSuccess"}}}},"404":{"description":"Invocación no encontrada."}}}},"/integrations/invocations/{id}/replay":{"post":{"operationId":"replayIntegrationInvocation","summary":"Reejecutar explícitamente una invocación terminal","description":"Crea una invocación auditable nueva. Los resultados indeterminados de escrituras solo se reconcilian cuando el proveedor ofrece idempotencia.","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInvocationReplayInput"}}}},"responses":{"200":{"description":"Replay idempotente existente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInvocationSuccess"}}}},"202":{"description":"Replay aceptado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInvocationSuccess"}}}},"409":{"description":"El estado o la política de idempotencia no permiten replay."}}}},"/integrations/artifacts/{id}":{"get":{"operationId":"getIntegrationArtifact","summary":"Consultar metadatos de un artefacto privado","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Artefacto sin ruta privada ni URL pública.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationArtifactSuccess"}}}},"404":{"description":"No encontrado, eliminado o vencido."}}},"delete":{"operationId":"deleteIntegrationArtifact","summary":"Eliminar explícitamente un artefacto privado","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Artefacto eliminado."},"404":{"description":"No encontrado."}}}},"/integrations/artifacts/{id}/content":{"get":{"operationId":"downloadIntegrationArtifact","summary":"Descargar un artefacto privado autorizado","tags":["Integrations"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Contenido binario privado.","headers":{"Cache-Control":{"schema":{"type":"string","enum":["private, no-store"]}}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"No encontrado, eliminado o vencido."}}}},"/entitlements":{"get":{"operationId":"getEffectiveEntitlements","tags":["Entitlements"],"summary":"Consultar contratación y consumo efectivos del Business","responses":{"200":{"description":"Entitlements efectivos de solo lectura.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialSnapshotSuccess"}}}}}}},"/authorization/me":{"get":{"operationId":"getAuthorizationContext","summary":"Obtener permisos efectivos de la sesion","tags":["Authorization"],"parameters":[{"$ref":"#/components/parameters/OptionalWorkspaceIdHeader"}],"responses":{"200":{"description":"Contexto autorizado efectivo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthorizationContextSuccess"}}}},"403":{"description":"Membresia inactiva o acceso insuficiente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericError"}}}}}}},"/authorization/permissions":{"get":{"operationId":"listPermissionCatalog","summary":"Listar catalogo de permisos","tags":["Authorization"],"parameters":[{"in":"query","name":"scope","schema":{"type":"string","enum":["business","workspace"]}}],"responses":{"200":{"description":"Catalogo de permisos delegables y sensibles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionListSuccess"}}}}}}},"/roles":{"get":{"operationId":"listBusinessRoles","summary":"Listar roles de negocio","tags":["Roles"],"responses":{"200":{"description":"Roles de negocio.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleListSuccess"}}}}}},"post":{"operationId":"createBusinessRole","summary":"Crear rol personalizado de negocio","tags":["Roles"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRoleInput"}}}},"responses":{"201":{"description":"Rol creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleSuccess"}}}}}}},"/roles/{roleId}":{"put":{"operationId":"updateBusinessRole","summary":"Actualizar rol personalizado de negocio","tags":["Roles"],"parameters":[{"$ref":"#/components/parameters/RoleIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRoleInput"}}}},"responses":{"200":{"description":"Rol actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleSuccess"}}}}}},"delete":{"operationId":"archiveBusinessRole","summary":"Archivar rol personalizado de negocio","tags":["Roles"],"parameters":[{"$ref":"#/components/parameters/RoleIdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/members":{"get":{"operationId":"listBusinessMembers","summary":"Listar usuarios del negocio","tags":["Users"],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["invited","active","suspended"]}}],"responses":{"200":{"description":"Usuarios paginados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberListSuccess"}}}}}},"post":{"operationId":"createBusinessMember","summary":"Agregar usuario al negocio y asignar roles","tags":["Users"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberCreateInput"}}}},"responses":{"201":{"description":"Usuario agregado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberSuccess"}}}}}}},"/members/{membershipId}/roles":{"put":{"operationId":"updateBusinessMemberRoles","summary":"Actualizar roles de negocio de un usuario","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/MembershipIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberBusinessRolesInput"}}}},"responses":{"200":{"description":"Roles actualizados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberSuccess"}}}}}}},"/members/{membershipId}/workspaces/{workspaceId}":{"put":{"operationId":"setBusinessMemberWorkspaceRoles","summary":"Asignar usuario y roles a un Workspace","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/MembershipIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberWorkspaceRolesInput"}}}},"responses":{"200":{"description":"Asignacion actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberSuccess"}}}}}},"delete":{"operationId":"removeBusinessMemberWorkspace","summary":"Retirar usuario de un Workspace","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/MembershipIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"responses":{"200":{"description":"Asignacion retirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberSuccess"}}}}}}},"/members/{membershipId}/suspend":{"post":{"operationId":"suspendBusinessMember","summary":"Suspender usuario del negocio","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/MembershipIdPathParam"}],"responses":{"200":{"description":"Usuario suspendido.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberSuccess"}}}}}}},"/members/{membershipId}/reinstate":{"post":{"operationId":"reinstateBusinessMember","summary":"Reactivar usuario del negocio","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/MembershipIdPathParam"}],"responses":{"200":{"description":"Usuario reactivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberSuccess"}}}}}}},"/teams":{"get":{"operationId":"listTeams","summary":"Listar equipos del Workspace","tags":["Teams"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"include_archived","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Equipos del Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamListSuccess"}}}}}},"post":{"operationId":"createTeam","summary":"Crear equipo de atención","tags":["Teams"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamInput"}}}},"responses":{"201":{"description":"Equipo creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamSuccess"}}}}}}},"/teams/{teamId}":{"get":{"operationId":"getTeam","summary":"Obtener equipo de atención","tags":["Teams"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/TeamIdPathParam"}],"responses":{"200":{"description":"Equipo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamSuccess"}}}}}},"put":{"operationId":"updateTeam","summary":"Actualizar equipo de atención","tags":["Teams"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/TeamIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamInput"}}}},"responses":{"200":{"description":"Equipo actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamSuccess"}}}}}},"delete":{"operationId":"archiveTeam","summary":"Archivar equipo de atención","tags":["Teams"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/TeamIdPathParam"}],"responses":{"204":{"description":"Equipo archivado."}}}},"/teams/{teamId}/restore":{"post":{"operationId":"restoreTeam","summary":"Restaurar equipo de atención","tags":["Teams"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/TeamIdPathParam"}],"responses":{"200":{"description":"Equipo restaurado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamSuccess"}}}}}}},"/workspaces/{workspaceId}/roles/permissions":{"get":{"operationId":"listWorkspacePermissionCatalog","summary":"Listar permisos asignables a roles de Workspace","tags":["Roles"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"responses":{"200":{"description":"Catalogo de permisos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionListSuccess"}}}}}}},"/workspaces/{workspaceId}/roles":{"get":{"operationId":"listWorkspaceRoles","summary":"Listar roles de Workspace","tags":["Roles"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"responses":{"200":{"description":"Roles de Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleListSuccess"}}}}}},"post":{"operationId":"createWorkspaceRole","summary":"Crear rol personalizado de Workspace","tags":["Roles"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRoleInput"}}}},"responses":{"201":{"description":"Rol creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleSuccess"}}}}}}},"/workspaces/{workspaceId}/roles/{roleId}":{"put":{"operationId":"updateWorkspaceRole","summary":"Actualizar rol personalizado de Workspace","tags":["Roles"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"},{"$ref":"#/components/parameters/RoleIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRoleInput"}}}},"responses":{"200":{"description":"Rol actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleSuccess"}}}}}},"delete":{"operationId":"archiveWorkspaceRole","summary":"Archivar rol personalizado de Workspace","tags":["Roles"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"},{"$ref":"#/components/parameters/RoleIdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/templates":{"get":{"operationId":"listWorkspaceTemplates","summary":"Listar plantillas del Workspace","tags":["Templates"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Listado obtenido correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericListSuccess"},"example":{"success":true,"data":[{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"}],"meta":{"page":1,"limit":10,"total":1,"total_pages":1}}}}}}},"post":{"operationId":"createWorkspaceTemplate","summary":"Crear una plantilla idempotente","tags":["Templates"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceTemplateInput"}}}},"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/templates/{id}":{"put":{"operationId":"updateWorkspaceTemplate","summary":"Actualizar una plantilla","tags":["Templates"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceTemplateUpdate"}}}},"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}},"delete":{"operationId":"archiveWorkspaceTemplate","summary":"Archivar una plantilla","tags":["Templates"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/notifications":{"get":{"operationId":"listNotifications","summary":"Listar notificaciones in-app del usuario","tags":["Notifications"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Listado obtenido correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericListSuccess"},"example":{"success":true,"data":[{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"}],"meta":{"page":1,"limit":10,"total":1,"total_pages":1}}}}}}},"post":{"operationId":"createNotification","summary":"Crear una notificación y encolar FCM multidispositivo","tags":["Notifications"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationCreateInput"}}}},"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/notifications/devices/current":{"put":{"operationId":"registerNotificationDevice","summary":"Registrar o refrescar el dispositivo actual","tags":["Notifications"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationDeviceInput"}}}},"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/notifications/devices/{installationId}":{"delete":{"operationId":"revokeNotificationDevice","summary":"Revocar un dispositivo","tags":["Notifications"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"installationId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/notifications/{id}/read":{"post":{"operationId":"markNotificationRead","summary":"Marcar una notificación como leída","tags":["Notifications"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/notifications/read-all":{"post":{"operationId":"markAllNotificationsRead","summary":"Marcar todas las notificaciones como leídas","tags":["Notifications"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/studio-ai/access":{"get":{"operationId":"getStudioAiAccess","summary":"Explicar la disponibilidad de Luna en el Workspace activo","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Estado de contratación, habilitación y permiso para Luna.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiAccessSuccess"}}}}}}},"/studio-ai/metrics":{"get":{"operationId":"getStudioAiMetrics","summary":"Consultar métricas seguras de 360studio AI por Workspace","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"from","required":false,"schema":{"type":"string","format":"date-time"}},{"in":"query","name":"to","required":false,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Agregados por propósito, modelo, perfil, resultado y herramienta sin contenido privado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiMetricsSuccess"}}}}}}},"/studio-ai/sessions":{"get":{"operationId":"listStudioAiSessions","summary":"Listar sesiones propias de 360studio AI","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Sesiones autorizadas del usuario en el Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiSessionListSuccess"}}}}}},"post":{"operationId":"createStudioAiSession","summary":"Crear idempotentemente una sesión de 360studio AI","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiSessionCreateInput"}}}},"responses":{"201":{"description":"Sesión creada o recuperada idempotentemente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiSessionSuccess"}}}},"409":{"description":"La clave idempotente ya se usó con otro propósito.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericError"}}}}}}},"/studio-ai/sessions/{sessionId}":{"get":{"operationId":"getStudioAiSession","summary":"Obtener una sesión propia de 360studio AI","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"sessionId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"responses":{"200":{"description":"Sesión encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiSessionSuccess"}}}},"404":{"description":"Sesión no visible en el scope autorizado."}}}},"/studio-ai/sessions/{sessionId}/close":{"post":{"operationId":"closeStudioAiSession","summary":"Cerrar idempotentemente una sesión propia de 360studio AI","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"sessionId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"responses":{"200":{"description":"Sesión cerrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiSessionSuccess"}}}},"404":{"description":"Sesión no visible en el scope autorizado."}}}},"/studio-ai/sessions/{sessionId}/turns":{"get":{"operationId":"listStudioAiConversationTurns","summary":"Listar el historial retenido de una conversación propia de Luna","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"sessionId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"responses":{"200":{"description":"Turnos visibles para el usuario y scope activos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiConversationTurnListSuccess"}}}},"404":{"description":"Sesión no visible en el scope autorizado."}}},"post":{"operationId":"createStudioAiConversationTurn","summary":"Consultar Luna y preparar propuestas sin ejecutar mutaciones","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"sessionId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiTurnCreateInput"}}}},"responses":{"201":{"description":"Turno completado o recuperado idempotentemente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiConversationTurnSuccess"}}}},"409":{"description":"La sesión está cerrada o el turno idempotente sigue en proceso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericError"}}}}}}},"/studio-ai/sessions/{sessionId}/action-proposals":{"get":{"operationId":"listStudioAiActionProposals","summary":"Listar propuestas propias de una sesión de Luna","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"sessionId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"responses":{"200":{"description":"Propuestas visibles para el actor y Workspace actuales.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiActionProposalListSuccess"}}}}}},"post":{"operationId":"createStudioAiActionProposal","summary":"Crear idempotentemente una propuesta tipada sin ejecutar la acción","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"sessionId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiActionProposalCreateInput"}}}},"responses":{"201":{"description":"Vista previa pendiente de aprobación.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiActionProposalSuccess"}}}},"403":{"description":"El actor no puede proponer esa acción."},"409":{"description":"Referencias o clave idempotente en conflicto."}}}},"/studio-ai/action-proposals/{proposalId}/approve":{"post":{"operationId":"approveStudioAiActionProposal","summary":"Aprobar y ejecutar una propuesta propia con su huella exacta","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"proposalId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiActionProposalApproveInput"}}}},"responses":{"200":{"description":"Estado durable de la ejecución; los replays no duplican la acción.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiActionProposalSuccess"}}}},"403":{"description":"El permiso requerido ya no está vigente."},"409":{"description":"La huella no coincide o la propuesta ya no puede aprobarse."}}}},"/studio-ai/action-proposals/{proposalId}/cancel":{"post":{"operationId":"cancelStudioAiActionProposal","summary":"Cancelar una propuesta propia pendiente","tags":["Studio AI"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"proposalId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"responses":{"200":{"description":"Propuesta cancelada idempotentemente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudioAiActionProposalSuccess"}}}},"409":{"description":"La propuesta ya no está pendiente."}}}},"/broadcasts":{"get":{"operationId":"listBroadcasts","summary":"Listar difusiones con métricas","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Difusiones obtenidas correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastListSuccess"}}}}}},"post":{"operationId":"createBroadcast","summary":"Crear borrador de difusión","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastInput"}}}},"responses":{"201":{"description":"Difusión creada correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastSuccess"}}}}}}},"/audience-segments/catalog":{"get":{"operationId":"getAudienceSegmentCatalog","summary":"Obtener campos y operadores permitidos para segmentos","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Catálogo de segmentación.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceCatalogSuccess"}}}}}}},"/audience-segments/preview":{"post":{"operationId":"previewAudienceDefinition","summary":"Previsualizar una definición de audiencia sin guardarla","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudiencePreviewInput"}}}},"responses":{"200":{"description":"Conteo y muestra calculados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudiencePreviewSuccess"}}}}}}},"/audience-segments":{"get":{"operationId":"listAudienceSegments","summary":"Listar segmentos de audiencia","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Segmentos obtenidos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceSegmentListSuccess"}}}}}},"post":{"operationId":"createAudienceSegment","summary":"Crear segmento de audiencia","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceSegmentInput"}}}},"responses":{"201":{"description":"Segmento creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceSegmentSuccess"}}}}}}},"/audience-segments/{id}":{"get":{"operationId":"getAudienceSegment","summary":"Obtener segmento de audiencia","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Segmento obtenido.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceSegmentSuccess"}}}}}},"put":{"operationId":"updateAudienceSegment","summary":"Actualizar segmento con control de revisión","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceSegmentUpdate"}}}},"responses":{"200":{"description":"Segmento actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceSegmentSuccess"}}}}}},"delete":{"operationId":"archiveAudienceSegment","summary":"Archivar segmento de audiencia","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"},{"name":"expected_revision","in":"query","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"204":{"description":"Segmento archivado."}}}},"/audience-segments/{id}/preview":{"post":{"operationId":"previewAudienceSegment","summary":"Previsualizar segmento guardado","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Conteo y muestra calculados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudiencePreviewSuccess"}}}}}}},"/audience-operations":{"get":{"operationId":"listAudienceOperations","summary":"Listar operaciones ejecutadas desde segmentos","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Operaciones obtenidas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceOperationListSuccess"}}}}}},"post":{"operationId":"executeAudienceOperation","summary":"Confirmar y ejecutar una operación masiva sobre un snapshot de segmento","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceOperationInput"}}}},"responses":{"201":{"description":"Operación ejecutada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceOperationSuccess"}}}}}}},"/audience-imports":{"get":{"operationId":"listAudienceImports","summary":"Listar lotes de importación de audiencias","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Importaciones obtenidas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceImportListSuccess"}}}}}},"post":{"operationId":"createAudienceImport","summary":"Importar y vincular Contactos a un segmento","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceImportInput"}}}},"responses":{"201":{"description":"Importación procesada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceImportSuccess"}}}}}}},"/broadcast-suppressions":{"get":{"operationId":"listBroadcastSuppressions","summary":"Listar Contactos excluidos de Difusiones","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Supresiones obtenidas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastSuppressionListSuccess"}}}}}},"post":{"operationId":"createBroadcastSuppression","summary":"Excluir un Contacto de Difusiones","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastSuppressionInput"}}}},"responses":{"201":{"description":"Contacto excluido.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastSuppressionSuccess"}}}}}}},"/broadcast-suppressions/{contactId}":{"delete":{"operationId":"deleteBroadcastSuppression","summary":"Retirar un Contacto de la lista de supresión","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"name":"contactId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Supresión retirada."}}}},"/acquisition-campaigns":{"get":{"operationId":"listAcquisitionCampaigns","summary":"Listar campañas externas de adquisición y sus Cases","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Métricas de adquisición obtenidas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcquisitionCampaignMetricListSuccess"}}}}}}},"/broadcasts/{id}":{"get":{"operationId":"getBroadcast","summary":"Obtener difusión, métricas y destinatarios","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Detalle de difusión obtenido correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastDetailSuccess"}}}}}},"put":{"operationId":"updateBroadcast","summary":"Actualizar borrador de difusión","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastInput"}}}},"responses":{"200":{"description":"Difusión actualizada correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastSuccess"}}}}}},"delete":{"operationId":"archiveBroadcast","summary":"Archivar una difusión inactiva","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"204":{"description":"Difusión archivada correctamente."},"409":{"description":"La difusión debe cancelarse antes de archivarse."}}}},"/broadcasts/{id}/launch":{"post":{"operationId":"launchBroadcast","summary":"Programar o iniciar difusión","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Difusión iniciada o programada correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastSuccess"}}}}}}},"/broadcasts/{id}/cancel":{"post":{"operationId":"cancelBroadcast","summary":"Cancelar difusión","tags":["Broadcasts"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Difusión cancelada correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastSuccess"}}}}}}},"/forms":{"get":{"operationId":"listForms","summary":"Listar formularios del Workspace","tags":["Forms"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Formularios visibles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormDefinitionListSuccess"}}}}}},"post":{"operationId":"createForm","summary":"Crear y publicar un formulario","tags":["Forms"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormDefinitionInput"}}}},"responses":{"201":{"description":"Formulario creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormDefinitionSuccess"}}}},"409":{"description":"Slug duplicado."}}}},"/forms/{id}":{"put":{"operationId":"updateForm","summary":"Actualizar un formulario","tags":["Forms"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormDefinitionInput"}}}},"responses":{"200":{"description":"Formulario actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormDefinitionSuccess"}}}}}},"delete":{"operationId":"archiveForm","summary":"Archivar un formulario","tags":["Forms"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Formulario archivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormArchiveSuccess"}}}}}}},"/calendars":{"get":{"operationId":"listCalendarConfigurations","summary":"Listar calendarios y sus links","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Calendarios visibles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarConfigurationListSuccess"}}}}}},"post":{"operationId":"createCalendarConfiguration","summary":"Crear calendario, tipo de cita y link público","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarConfigurationInput"}}}},"responses":{"201":{"description":"Calendario creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarConfigurationSuccess"}}}},"409":{"description":"Slug duplicado."}}}},"/calendars/{id}":{"put":{"operationId":"updateCalendarConfiguration","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarConfigurationInput"}}}},"responses":{"200":{"description":"Calendar configuration updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarConfigurationSuccess"}}}},"400":{"description":"Configuración inválida."},"403":{"description":"El usuario no puede configurar este calendario."},"404":{"description":"Calendario no encontrado."}}},"delete":{"operationId":"archiveCalendarConfiguration","summary":"Archivar un calendario y su link","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Calendario archivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarArchiveSuccess"}}}}}}},"/calendars/{id}/availability":{"get":{"operationId":"getCalendarAvailability","summary":"Listar slots efectivos disponibles para un calendario","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"name":"date","in":"query","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Slots disponibles considerando citas, bloqueos y buffers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarAvailabilitySuccess"}}}},"404":{"description":"Calendario no encontrado."}}}},"/calendars/reminders":{"get":{"operationId":"listCalendarReminders","summary":"Listar recordatorios durables visibles para el usuario","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Recordatorios programados, ejecutados o cancelados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarReminderListSuccess"}}}}}}},"/calendars/reminders/{id}/cancel":{"post":{"operationId":"cancelCalendarReminder","summary":"Cancelar un recordatorio todavía programado","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Recordatorio cancelado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarReminderCancelSuccess"}}}},"409":{"description":"El recordatorio ya fue ejecutado."}}}},"/calendars/entries":{"get":{"operationId":"listCalendarEntries","summary":"Listar citas y bloqueos de los calendarios del Workspace","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"name":"from","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"calendar_id","in":"query","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"responses":{"200":{"description":"Entradas visibles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEntryListSuccess"}}}}}},"post":{"operationId":"createCalendarEntry","summary":"Crear una cita manual o un bloqueo de disponibilidad","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEntryInput"}}}},"responses":{"201":{"description":"Entrada creada y disponibilidad ocupada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEntrySuccess"}}}},"409":{"description":"El intervalo ya está ocupado."}}}},"/calendars/entries/{id}/cancel":{"post":{"operationId":"cancelCalendarEntry","summary":"Cancelar una cita o bloqueo activo","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Entrada cancelada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEntryCancelSuccess"}}}}}}},"/calendars/entries/{id}":{"put":{"operationId":"rescheduleCalendarEntry","summary":"Reprogramar atómicamente una cita o bloqueo","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEntryRescheduleInput"}}}},"responses":{"200":{"description":"Entrada reprogramada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEntrySuccess"}}}},"409":{"description":"El nuevo intervalo está ocupado."}}}},"/products":{"get":{"operationId":"listProducts","summary":"Listar productos del negocio","tags":["Products"],"responses":{"200":{"description":"Productos visibles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductListSuccess"}}}}}},"post":{"operationId":"createProduct","summary":"Crear producto en el inventario del negocio","tags":["Products"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"}}}},"responses":{"201":{"description":"Producto creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}}},"/products/{id}":{"put":{"operationId":"updateProduct","summary":"Actualizar producto del negocio","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductUpdateInput"}}}},"responses":{"200":{"description":"Producto actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}},"delete":{"operationId":"archiveProduct","summary":"Archivar producto del negocio","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Producto archivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductArchiveSuccess"}}}}}}},"/products/{id}/images":{"post":{"operationId":"uploadProductImage","summary":"Cargar una imagen en la galería del producto","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductImageUploadInput"}}}},"responses":{"201":{"description":"Imagen cargada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}},"put":{"operationId":"reorderProductImages","summary":"Reordenar la galería del producto","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductImageOrderInput"}}}},"responses":{"200":{"description":"Galería reordenada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}}},"/products/{id}/images/{imageId}":{"delete":{"operationId":"deleteProductImage","summary":"Eliminar una imagen del producto","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"imageId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Imagen eliminada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}}},"/products/{id}/variants":{"post":{"operationId":"createProductVariant","summary":"Crear una variante vendible del producto","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductVariantInput"}}}},"responses":{"201":{"description":"Variante creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}}},"/products/{id}/variants/{variantId}":{"put":{"operationId":"updateProductVariant","summary":"Actualizar una variante vendible del producto","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"variantId","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductVariantUpdateInput"}}}},"responses":{"200":{"description":"Variante actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}},"delete":{"operationId":"archiveProductVariant","summary":"Archivar una variante vendible del producto","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"variantId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Variante archivada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}}},"/products/{id}/variants/{variantId}/images":{"post":{"operationId":"uploadProductVariantImage","summary":"Cargar una imagen propia de una variante","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"variantId","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductImageUploadInput"}}}},"responses":{"201":{"description":"Imagen de variante cargada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}},"put":{"operationId":"reorderProductVariantImages","summary":"Reordenar las imágenes propias de una variante","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"variantId","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductImageOrderInput"}}}},"responses":{"200":{"description":"Galería de variante reordenada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}}},"/products/{id}/variants/{variantId}/images/{imageId}":{"delete":{"operationId":"deleteProductVariantImage","summary":"Eliminar una imagen propia de una variante","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"variantId","required":true,"schema":{"type":"string"}},{"in":"path","name":"imageId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Imagen de variante eliminada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}}},"/products/{id}/variants/{variantId}/stock-adjustments":{"post":{"operationId":"adjustProductVariantStock","summary":"Ajustar stock de una variante","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"variantId","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockAdjustmentInput"}}}},"responses":{"200":{"description":"Stock ajustado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}}},"/products/categories":{"get":{"operationId":"listProductCategories","summary":"Listar categorías de productos del negocio","tags":["Products"],"responses":{"200":{"description":"Categorías visibles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCategoryListSuccess"}}}}}},"post":{"operationId":"createProductCategory","summary":"Crear categoría de productos","tags":["Products"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCategoryInput"}}}},"responses":{"201":{"description":"Categoría creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCategorySuccess"}}}}}}},"/products/categories/{id}":{"put":{"operationId":"updateProductCategory","summary":"Actualizar categoría de productos","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCategoryUpdateInput"}}}},"responses":{"200":{"description":"Categoría actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCategorySuccess"}}}}}},"delete":{"operationId":"archiveProductCategory","summary":"Archivar categoría de productos","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Categoría archivada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCategoryArchiveSuccess"}}}}}}},"/products/categories/{id}/products/{productId}":{"post":{"operationId":"attachProductToCategory","summary":"Vincular un producto existente a la categoría","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"productId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Producto vinculado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}},"delete":{"operationId":"detachProductFromCategory","summary":"Desvincular un producto de la categoría","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"productId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Producto desvinculado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSuccess"}}}}}}},"/automations":{"get":{"operationId":"listAutomations","summary":"Listar definiciones de automatización del Workspace","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["draft","active","paused"]}}],"responses":{"200":{"description":"Definiciones visibles en el Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationListSuccess"}}}},"403":{"description":"Workspace no autorizado o herramienta automations deshabilitada."}}},"post":{"operationId":"createAutomation","summary":"Crear un borrador de automatización","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationCreateInput"}}}},"responses":{"201":{"description":"Borrador creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationSuccess"}}}},"403":{"description":"Se requiere administrador y herramienta automations."},"409":{"description":"El nombre ya existe en el Workspace."}}}},"/automations/{id}":{"get":{"operationId":"getAutomation","summary":"Obtener una definición de automatización","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Definición encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationSuccess"}}}},"404":{"description":"No existe en el Workspace autorizado."}}},"put":{"operationId":"updateAutomation","summary":"Reemplazar el borrador de una automatización","description":"La edición devuelve la definición a draft y exige reactivación explícita.","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationUpdateInput"}}}},"responses":{"200":{"description":"Borrador actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationSuccess"}}}},"409":{"description":"Revisión obsoleta o nombre duplicado."}}},"delete":{"operationId":"archiveAutomation","summary":"Archivar una automatización","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Definición archivada mediante soft delete.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationArchiveSuccess"}}}},"404":{"description":"No existe en el Workspace autorizado."}}}},"/automations/runs":{"get":{"operationId":"listAutomationRuns","summary":"Listar ejecuciones de automatización del Workspace","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"definition_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"status","schema":{"type":"string","enum":["running","succeeded","failed","poisoned"]}}],"responses":{"200":{"description":"Runs visibles en el Workspace con su estado agregado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRunListSuccess"}}}},"403":{"description":"Workspace no autorizado o herramienta automations deshabilitada."}}}},"/automations/catalog":{"get":{"operationId":"getAutomationCatalog","summary":"Obtener disparadores, efectos y equipos disponibles","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Catálogo del constructor visual para el Workspace.","content":{"application/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","required":["triggers","effects","teams"],"properties":{"triggers":{"type":"array","items":{"type":"object","additionalProperties":true}},"effects":{"type":"array","items":{"type":"object","additionalProperties":true}},"teams":{"type":"array","items":{"type":"object","required":["id","label"],"properties":{"id":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"label":{"type":"string"}}}}}}}}}}}}}},"/automations/runs/{runId}":{"get":{"operationId":"getAutomationRun","summary":"Obtener un run y el detalle ordenado de sus acciones","tags":["Automations"],"parameters":[{"in":"path","name":"runId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Run con resultados, skips, fallos y retries por acción.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRunDetailSuccess"}}}},"404":{"description":"Run no encontrado en el Workspace autorizado."}}}},"/automations/runs/{runId}/retry":{"post":{"operationId":"retryAutomationRun","summary":"Reintentar manualmente un run fallido o poisoned","tags":["Automations"],"parameters":[{"in":"path","name":"runId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Retry auditable solicitado y ejecutado mediante el runtime durable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRunRetrySuccess"}}}},"403":{"description":"Se requiere administrador del Business."},"404":{"description":"Run no encontrado en el Workspace autorizado."},"409":{"description":"El estado actual del run no admite retry manual."}}}},"/automations/operations":{"get":{"operationId":"getAutomationOperations","summary":"Consultar diagnóstico operativo del motor en el Workspace","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"from","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"to","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Backlog, latencia y estados agregados de runs y acciones.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationOperationsSuccess"}}}},"403":{"description":"Se requiere administrador del Business."}}}},"/automations/{id}/activate":{"post":{"operationId":"activateAutomation","summary":"Validar y activar una automatización","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationStatusInput"}}}},"responses":{"200":{"description":"Automatización activa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationSuccess"}}}},"400":{"description":"El borrador no cumple los requisitos de activación.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationValidationError"}}}},"409":{"description":"Revisión obsoleta."}}}},"/automations/{id}/pause":{"post":{"operationId":"pauseAutomation","summary":"Pausar una automatización activa","tags":["Automations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationStatusInput"}}}},"responses":{"200":{"description":"Automatización pausada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationSuccess"}}}},"409":{"description":"La definición no está activa o la revisión es obsoleta."}}}},"/messaging/whatsapp/onboarding-sessions":{"post":{"operationId":"startWhatsappOnboarding","summary":"Iniciar Meta Embedded Signup para el Workspace activo","description":"Crea una sesión corta, single-use y ligada al usuario, Business y Workspace autorizados.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappOnboardingStartInput"}}}},"responses":{"201":{"description":"Configuración pública y state efímero para abrir Embedded Signup.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappOnboardingLaunchSuccess"}}}},"403":{"description":"Se requiere administrador, Workspace autorizado y herramienta messaging habilitada."}}}},"/messaging/whatsapp/templates":{"get":{"operationId":"listWhatsappTemplates","summary":"Listar plantillas de WhatsApp del Workspace","description":"Devuelve el estado vigente en Meta, calidad, sincronización y elegibilidad para campañas.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Plantillas vinculadas al canal del Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappTemplateListSuccess"}}}}}},"post":{"operationId":"createWhatsappTemplate","summary":"Crear una plantilla en Meta","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappTemplateCreateInput"}}}},"responses":{"200":{"description":"Replay idempotente o reconciliación de una plantilla existente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappTemplateCreateSuccess"}}}},"201":{"description":"Plantilla creada en Meta y persistida.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappTemplateCreateSuccess"}}}},"403":{"description":"Se requiere rol admin."},"409":{"description":"Conflicto de nombre, contenido o idempotencia."},"502":{"description":"Meta rechazó la solicitud."},"503":{"description":"Meta no está disponible temporalmente."}}}},"/messaging/whatsapp/templates/sync":{"post":{"operationId":"syncWhatsappTemplates","summary":"Resincronizar las plantillas de un canal con Meta","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappTemplateSyncInput"}}}},"responses":{"200":{"description":"Estado de plantillas reconciliado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappTemplateSyncSuccess"}}}},"403":{"description":"Se requiere rol admin."},"503":{"description":"Meta no está disponible temporalmente."}}}},"/messaging/whatsapp/templates/{id}":{"get":{"operationId":"getWhatsappTemplate","summary":"Consultar una plantilla de WhatsApp","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Plantilla encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappTemplateSuccess"}}}},"404":{"description":"Plantilla no encontrada en el Workspace."}}}},"/messaging/whatsapp/templates/{id}/sync":{"post":{"operationId":"syncWhatsappTemplate","summary":"Resincronizar una plantilla de WhatsApp","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Plantilla reconciliada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappTemplateSuccess"}}}},"403":{"description":"Se requiere rol admin."},"404":{"description":"Plantilla no encontrada en el Workspace."}}}},"/messaging/whatsapp/onboarding-sessions/{id}":{"get":{"operationId":"getWhatsappOnboarding","summary":"Consultar el estado de Meta Embedded Signup","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Estado sanitizado de la sesión.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappOnboardingSessionSuccess"}}}},"404":{"description":"La sesión no existe en el scope del usuario y Workspace."}}}},"/messaging/whatsapp/onboarding-sessions/{id}/complete":{"post":{"operationId":"completeWhatsappOnboarding","summary":"Completar Meta Embedded Signup server-side","description":"Intercambia el código efímero, verifica activos Meta, suscribe el WABA y aprovisiona el canal. Nunca devuelve tokens.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappOnboardingCompleteInput"}}}},"responses":{"200":{"description":"Conexión y canal reconciliados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappOnboardingSessionSuccess"}}}},"400":{"description":"State inválido o resultado incompleto."},"409":{"description":"Sesión usada, en proceso o recurso asignado a otro scope."},"410":{"description":"Sesión expirada."},"502":{"description":"Meta rechazó o no pudo completar la operación."}}}},"/messaging/whatsapp/onboarding-sessions/{id}/cancel":{"post":{"operationId":"cancelWhatsappOnboarding","summary":"Cancelar una sesión recuperable de Embedded Signup","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Sesión cancelada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappOnboardingSessionSuccess"}}}}}}},"/messaging/whatsapp/onboarding-sessions/{id}/retry":{"post":{"operationId":"retryWhatsappOnboarding","summary":"Crear un nuevo intento de Embedded Signup","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappOnboardingStartInput"}}}},"responses":{"201":{"description":"Nuevo intento con state diferente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsappOnboardingLaunchSuccess"}}}},"409":{"description":"La sesión todavía no admite retry."}}}},"/messaging/connections":{"get":{"summary":"Listar conexiones de mensajería del Business","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Conexiones activas sin credenciales.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelConnectionListSuccess"}}}},"403":{"description":"Workspace no autorizado o herramienta deshabilitada."}}}},"/messaging/conversations":{"get":{"operationId":"listConversations","summary":"Listar y buscar conversaciones del Workspace","description":"Los administradores consultan todo el Workspace; los miembros solo conversaciones propias o sin asignar.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"in":"query","name":"status","schema":{"type":"string","enum":["open","closed"]}},{"in":"query","name":"channel_id","schema":{"type":"string"}},{"in":"query","name":"contact_id","schema":{"type":"string"}},{"in":"query","name":"case_id","schema":{"type":"string"}},{"in":"query","name":"assigned_user_id","schema":{"type":"string"}},{"in":"query","name":"queue","schema":{"type":"string","enum":["all","unassigned","mine"],"default":"all"}},{"in":"query","name":"search","schema":{"type":"string","minLength":1,"maxLength":100}}],"responses":{"200":{"description":"Página determinista de conversaciones.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationListSuccess"}}}},"403":{"description":"Workspace no autorizado o herramienta messaging deshabilitada."}}}},"/messaging/conversations/realtime/cursor":{"get":{"operationId":"getInboxRealtimeCursor","summary":"Obtener cursor de bootstrap del Inbox realtime","description":"El cursor se obtiene antes del snapshot REST para reconciliar sin perder cambios concurrentes.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Cursor actual del feed workspace-scoped.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxRealtimeCursorSuccess"}}}},"403":{"description":"Workspace no autorizado o herramienta messaging deshabilitada."}}}},"/messaging/conversations/realtime/access":{"post":{"operationId":"enableInboxRealtimeAccess","summary":"Habilitar el listener Firestore del Inbox para el usuario autenticado","description":"Proyecta un grant mínimo para Security Rules después de revalidar Business, Workspace, membership y messaging.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Acceso de lectura al feed Firestore habilitado para el Firebase UID autenticado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxRealtimeAccessSuccess"}}}},"403":{"description":"Workspace no autorizado o herramienta messaging deshabilitada."}}}},"/messaging/conversations/realtime/changes":{"get":{"operationId":"listInboxRealtimeChanges","summary":"Listar hints incrementales del Inbox","description":"Retorna solo IDs y versiones; Conversation, Message y multimedia se reconcilian desde endpoints REST autorizados.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"after","required":true,"schema":{"type":"integer","minimum":0}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"Lote ordenado por secuencia o instrucción de reset/reconciliación completa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxRealtimeChangesSuccess"}}}},"403":{"description":"Workspace no autorizado o herramienta messaging deshabilitada."}}}},"/messaging/conversations/template-messages":{"post":{"operationId":"startConversationWithTemplate","summary":"Iniciar o reutilizar una conversación enviando una plantilla","description":"Valida canal, contacto, Case y plantilla aprobada; persiste conversación, mensaje, auditoría y outbox.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartTemplateConversationInput"}}}},"responses":{"200":{"description":"Replay idempotente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartTemplateConversationSuccess"}}}},"202":{"description":"Conversación y mensaje persistidos; entrega encolada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartTemplateConversationSuccess"}}}},"400":{"description":"Canal, contacto o Case incompatibles."},"404":{"description":"No existe o el actor no está autorizado."},"409":{"description":"Plantilla no aprobada o conflicto idempotente."}}}},"/messaging/conversations/{id}":{"get":{"operationId":"getConversation","summary":"Consultar una conversación autorizada","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Conversación encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSuccess"}}}},"404":{"description":"No existe o el actor no puede conocer su existencia."}}}},"/messaging/conversations/{id}/messages":{"get":{"operationId":"listConversationMessages","summary":"Consultar historial paginado de una conversación","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"direction","schema":{"type":"string","enum":["inbound","outbound"]}},{"in":"query","name":"status","schema":{"type":"string","enum":["received","queued","sent","delivered","read","failed"]}}],"responses":{"200":{"description":"Historial más reciente primero.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageListSuccess"}}}},"404":{"description":"No existe o el actor no está autorizado."}}},"post":{"operationId":"sendConversationMessage","summary":"Encolar un mensaje enriquecido hacia WhatsApp","description":"Persiste el mensaje y su intención durable antes de ejecutar el efecto externo en Meta.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMessageInput"}}}},"responses":{"200":{"description":"Replay idempotente de la solicitud.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMessageSuccess"}}}},"202":{"description":"Mensaje persistido y envío durable encolado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMessageSuccess"}}}},"400":{"description":"Canal inactivo o Contact sin teléfono."},"404":{"description":"No existe o el actor no está autorizado."},"409":{"description":"Ventana de texto libre cerrada (requiere plantilla) o clave idempotente usada con otro payload.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/FreeFormWindowClosedError"},{"$ref":"#/components/schemas/GenericError"}]}}}}}}},"/messaging/conversations/{id}/notes":{"get":{"operationId":"listConversationNotes","summary":"Listar notas internas de una conversación","description":"Devuelve contenido visible solo para miembros autorizados del Workspace.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Notas internas de la conversación.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteListSuccess"}}}},"404":{"description":"Conversación no encontrada o no autorizada."}}},"post":{"operationId":"createConversationNote","summary":"Crear una nota interna en una conversación","description":"Relaciona la nota con el contacto y Ticket vigentes sin enviarla al cliente.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteCreateInput"}}}},"responses":{"201":{"description":"Nota interna creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteSuccess"}}}},"404":{"description":"Conversación o contacto no encontrado."}}}},"/messaging/conversations/{id}/notes/{noteId}":{"patch":{"operationId":"updateConversationNote","summary":"Editar una nota interna de una conversación","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"noteId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteUpdateInput"}}}},"responses":{"200":{"description":"Nota interna actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteSuccess"}}}},"403":{"description":"Solo el autor o un administrador de notas puede editarla."},"409":{"description":"La versión cambió desde que se cargó la nota."}}},"delete":{"operationId":"deleteConversationNote","summary":"Eliminar lógicamente una nota interna de una conversación","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"noteId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"expected_version","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Nota interna eliminada lógicamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteDeleteSuccess"}}}},"403":{"description":"Solo el autor o un administrador de notas puede eliminarla."},"409":{"description":"La versión cambió desde que se cargó la nota."}}}},"/messaging/conversations/{id}/media-uploads":{"post":{"operationId":"prepareConversationMediaUpload","summary":"Preparar la carga privada directa de un adjunto","description":"Valida la ventana de WhatsApp y devuelve una URL firmada temporal para cargar el binario sin base64.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMediaUploadInput"}}}},"responses":{"201":{"description":"Carga preparada con URL firmada de corta duración.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMediaUploadSuccess"}}}},"400":{"description":"Tipo, MIME o tamaño no soportado."},"404":{"description":"Conversación no encontrada o no autorizada."},"409":{"description":"Ventana de WhatsApp cerrada."}}}},"/messaging/conversations/{id}/media-uploads/{uploadId}":{"delete":{"operationId":"cancelConversationMediaUpload","summary":"Cancelar y eliminar una carga privada pendiente","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"uploadId","required":true,"schema":{"type":"string","pattern":"^[a-f0-9]{64}$"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"204":{"description":"Carga cancelada, incluso si ya no existía."},"404":{"description":"Conversación no encontrada o no autorizada."}}}},"/messaging/conversations/{id}/media-messages":{"post":{"operationId":"completeConversationMediaMessage","summary":"Validar una carga y encolar el adjunto hacia WhatsApp","description":"Comprueba firma, MIME y tamaño del binario privado antes de persistir el mensaje y su outbox durable.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMediaCompleteInput"}}}},"responses":{"200":{"description":"Replay idempotente de la solicitud.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMessageSuccess"}}}},"202":{"description":"Adjunto validado, persistido y entrega durable encolada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMessageSuccess"}}}},"400":{"description":"Carga ausente, alterada o incompatible con lo declarado."},"404":{"description":"Conversación no encontrada o no autorizada."},"409":{"description":"Ventana cerrada o conflicto idempotente."}}}},"/messaging/conversations/{id}/messages/{messageId}/media":{"get":{"operationId":"downloadConversationMessageMedia","summary":"Descargar multimedia privada de una conversación","description":"Entrega el archivo solo después de validar el Business, Workspace y acceso del asesor a la conversación.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"messageId","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Contenido binario con el MIME validado al recibirlo desde Meta.","headers":{"Cache-Control":{"schema":{"type":"string","example":"private, no-store"}},"Content-Disposition":{"schema":{"type":"string"}}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Mensaje no encontrado, sin media o conversación no autorizada."}}}},"/messaging/conversations/{id}/template-messages":{"post":{"operationId":"sendConversationTemplateMessage","summary":"Enviar una plantilla aprobada en una conversación","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundTemplateMessageInput"}}}},"responses":{"200":{"description":"Replay idempotente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMessageSuccess"}}}},"202":{"description":"Mensaje de plantilla persistido y encolado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundMessageSuccess"}}}},"404":{"description":"Conversación no accesible."},"409":{"description":"Plantilla inválida o conflicto idempotente."}}}},"/messaging/conversations/{id}/read":{"post":{"operationId":"markConversationRead","summary":"Marcar una conversación como leída para el usuario actual","description":"Avanza de forma idempotente el cursor personal hasta el último mensaje inbound visible.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Cursor actualizado y conversación reconciliada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSuccess"}}}},"404":{"description":"No existe o el actor no está autorizado."}}}},"/messaging/conversations/{id}/assignment":{"patch":{"operationId":"assignConversation","summary":"Asignar o reclamar una conversación","description":"Admin puede asignar cualquier miembro activo; un miembro solo puede reclamar para sí una conversación sin asignar.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAssignmentInput"}}}},"responses":{"200":{"description":"Asignación actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSuccess"}}}},"404":{"description":"No existe o la política oculta su existencia."},"409":{"description":"Conflicto de versión."}}}},"/messaging/conversations/{id}/case":{"patch":{"operationId":"linkConversationCase","summary":"Vincular o desvincular un Case de la conversación","description":"Admin o responsable actual pueden vincular un Case abierto del mismo Contact y Workspace. Enviar null desvincula.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationCaseInput"}}}},"responses":{"200":{"description":"Vínculo actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSuccess"}}}},"400":{"description":"Case cerrado o incompatible con Contact/Workspace."},"404":{"description":"No existe o la política oculta su existencia."},"409":{"description":"Conflicto de versión."}}}},"/messaging/conversations/{id}/handoffs":{"get":{"operationId":"listConversationHandoffs","summary":"Consultar el historial de traspasos de una conversación","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Historial transversal y trazable de la conversación.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationHandoffListSuccess"}}}},"404":{"description":"La conversación no pertenece al Workspace actual."}}},"post":{"operationId":"handoffConversation","summary":"Transferir una conversación a un Workspace autorizado","description":"Mueve la operación y el historial de forma atómica, conserva el origen y limpia vínculos propios del Workspace de salida.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationHandoffInput"}}}},"responses":{"200":{"description":"Conversación transferida.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationHandoffSuccess"}}}},"403":{"description":"Destino o canal no autorizado."},"404":{"description":"La conversación no existe en el Workspace de salida."},"409":{"description":"Destino no disponible, Messaging deshabilitado o conflicto de versión."}}}},"/messaging/conversations/{id}/open":{"post":{"operationId":"openConversation","summary":"Reabrir una conversación","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationLifecycleInput"}}}},"responses":{"200":{"description":"Conversación abierta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSuccess"}}}},"409":{"description":"Versión desactualizada u otra conversación abierta para el mismo contacto/canal."}}}},"/messaging/conversations/{id}/close":{"post":{"operationId":"closeConversation","summary":"Cerrar una conversación","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationLifecycleInput"}}}},"responses":{"200":{"description":"Conversación cerrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSuccess"}}}},"409":{"description":"Conflicto de versión."}}}},"/messaging/connections/{id}":{"get":{"summary":"Obtener conexión de mensajería","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Conexión encontrada sin credenciales.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelConnectionSuccess"}}}},"404":{"description":"Conexión no encontrada en el Business."}}},"patch":{"summary":"Actualizar conexión y entrega de conversiones de WhatsApp","description":"Las credenciales solo se aprovisionan mediante Meta Embedded Signup. Permite habilitar conversiones con Dataset ID y un código write-only de Meta Test Events; tokens y códigos no se devuelven.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelConnectionUpdateInput"}}}},"responses":{"200":{"description":"Conexión actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelConnectionSuccess"}}}},"403":{"description":"Se requiere rol admin."},"404":{"description":"Conexión no encontrada."}}},"delete":{"summary":"Archivar una conexión sin canales activos","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Conexión archivada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagingArchiveSuccess"}}}},"404":{"description":"Conexión no encontrada."},"409":{"description":"La conexión conserva canales activos."}}}},"/messaging/channels":{"get":{"summary":"Listar canales del Workspace autorizado","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Canales activos del Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceChannelListSuccess"}}}}}}},"/messaging/channels/{id}":{"get":{"summary":"Obtener canal del Workspace autorizado","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Canal encontrado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceChannelSuccess"}}}},"404":{"description":"Canal no encontrado en el Workspace."}}},"patch":{"summary":"Actualizar o desactivar canal del Workspace","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceChannelUpdateInput"}}}},"responses":{"200":{"description":"Canal actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceChannelSuccess"}}}},"403":{"description":"Se requiere rol admin."},"404":{"description":"Canal no encontrado."}}},"delete":{"summary":"Archivar canal del Workspace","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Canal archivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagingArchiveSuccess"}}}},"404":{"description":"Canal no encontrado."},"409":{"description":"El canal conserva conversaciones abiertas."}}}},"/messaging/channels/{id}/transfer":{"post":{"operationId":"transferWorkspaceChannel","summary":"Transferir un canal a otro Workspace activo","description":"Conserva la conexión de Meta a nivel de Business. Requiere Messaging habilitado en el destino y no admite conversaciones abiertas fuera de ese Workspace.","tags":["Messaging"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceChannelTransferInput"}}}},"responses":{"200":{"description":"Canal transferido; el número conserva su conexión de Meta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceChannelSuccess"}}}},"403":{"description":"Se requiere rol admin."},"404":{"description":"Canal no encontrado en el Workspace origen."},"409":{"description":"Destino inválido, Messaging deshabilitado o existen conversaciones abiertas fuera del destino."}}}},"/assistant/assistants":{"get":{"operationId":"listAssistants","summary":"Listar Assistants del Workspace","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Assistants configurados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantDefinitionListSuccess"}}}}}},"post":{"operationId":"createAssistant","summary":"Crear Assistant con flow publicado por defecto","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantDefinitionCreateInput"}}}},"responses":{"201":{"description":"Assistant creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantDefinitionSuccess"}}}},"400":{"description":"El flow no existe o no tiene publicación."},"403":{"description":"Se requiere administrador."},"409":{"description":"Nombre duplicado."}}}},"/assistant/assistants/{id}":{"get":{"operationId":"getAssistant","summary":"Obtener configuración de Assistant","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Assistant encontrado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantDefinitionSuccess"}}}},"404":{"description":"Assistant no encontrado."}}},"put":{"operationId":"updateAssistant","summary":"Reemplazar configuración con control optimista","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantDefinitionUpdateInput"}}}},"responses":{"200":{"description":"Assistant actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantDefinitionSuccess"}}}},"409":{"description":"Versión obsoleta o nombre duplicado."}}}},"/assistant/channel-bindings":{"get":{"operationId":"listAssistantChannelBindings","summary":"Listar bindings activos por canal","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Bindings activos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantChannelBindingListSuccess"}}}}}}},"/assistant/channel-bindings/{channelId}":{"put":{"operationId":"bindAssistantChannel","summary":"Asignar Assistant activo al canal","tags":["Assistant"],"parameters":[{"in":"path","name":"channelId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantChannelBindingInput"}}}},"responses":{"200":{"description":"Binding creado o reemplazado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantChannelBindingSuccess"}}}},"400":{"description":"Canal o Assistant inválido."}}},"delete":{"operationId":"unbindAssistantChannel","summary":"Eliminar binding activo del canal","tags":["Assistant"],"parameters":[{"in":"path","name":"channelId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Binding eliminado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantChannelBindingDeleteSuccess"}}}},"404":{"description":"Binding no encontrado."}}}},"/assistant/conversations/{conversationId}/session":{"get":{"operationId":"getConversationAssistantSession","summary":"Consultar pin y estado de sesión","tags":["Assistant"],"parameters":[{"in":"path","name":"conversationId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Sesión encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAssistantSessionSuccess"}}}},"404":{"description":"Sesión no encontrada."}}},"post":{"operationId":"startConversationAssistantSession","summary":"Crear sesión y fijar publicación vigente","tags":["Assistant"],"parameters":[{"in":"path","name":"conversationId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"201":{"description":"Sesión creada o replay idempotente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAssistantSessionSuccess"}}}},"400":{"description":"Conversación, binding o publicación inválida."}}}},"/assistant/effects/catalog":{"get":{"operationId":"listAssistantEffectCatalog","summary":"Listar catálogo publicado de effects","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Tipos, versiones, permisos y capabilities soportados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EffectCatalogSuccess"}}}}}}},"/assistant/ai-usage":{"get":{"operationId":"getAssistantAiUsage","summary":"Agregar uso y costo estimado de IA del Workspace","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"assistant_id","schema":{"type":"string"}},{"in":"query","name":"conversation_id","schema":{"type":"string"}},{"in":"query","name":"from","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"to","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Uso tenant-scoped agregable por Assistant y conversación.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantAiUsageSuccess"}}}},"400":{"description":"Filtros inválidos."},"403":{"description":"Se requiere administrador, Workspace autorizado y herramienta assistant habilitada."}}}},"/assistant/conversations/{conversationId}/session/pause":{"post":{"operationId":"pauseConversationAssistantSession","summary":"Pausar sesión idempotentemente","tags":["Assistant"],"parameters":[{"in":"path","name":"conversationId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantSessionControlInput"}}}},"responses":{"200":{"description":"Sesión pausada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAssistantSessionSuccess"}}}},"409":{"description":"Versión obsoleta o transición inválida."}}}},"/assistant/conversations/{conversationId}/effect-runs":{"get":{"operationId":"listConversationAssistantEffectRuns","summary":"Listar ejecuciones auditables de effects de la sesión","tags":["Assistant"],"parameters":[{"in":"path","name":"conversationId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Effect runs ordenados por ejecución.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EffectRunListSuccess"}}}},"404":{"description":"Sesión no encontrada."}}}},"/assistant/conversations/{conversationId}/session/resume":{"post":{"operationId":"resumeConversationAssistantSession","summary":"Reanudar sesión idempotentemente","tags":["Assistant"],"parameters":[{"in":"path","name":"conversationId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantSessionControlInput"}}}},"responses":{"200":{"description":"Sesión reanudada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAssistantSessionSuccess"}}}},"409":{"description":"Versión obsoleta o transición inválida."}}}},"/assistant/conversations/{conversationId}/session/take-over":{"post":{"operationId":"takeOverConversationAssistantSession","summary":"Transferir el control de la conversación a una persona","tags":["Assistant"],"parameters":[{"in":"path","name":"conversationId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantSessionHandoffInput"}}}},"responses":{"200":{"description":"Control humano activado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAssistantSessionSuccess"}}}},"409":{"description":"Versión obsoleta, sesión terminal o Assistant trabajando."}}}},"/assistant/conversations/{conversationId}/session/return-to-assistant":{"post":{"operationId":"returnConversationAssistantSessionToAssistant","summary":"Devolver el control de la conversación al Assistant","tags":["Assistant"],"parameters":[{"in":"path","name":"conversationId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantSessionHandoffInput"}}}},"responses":{"200":{"description":"Control del Assistant restaurado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAssistantSessionSuccess"}}}},"409":{"description":"Versión obsoleta o sesión terminal."}}}},"/assistant/conversations/{conversationId}/session/terminate":{"post":{"operationId":"terminateConversationAssistantSession","summary":"Terminar sesión idempotentemente","tags":["Assistant"],"parameters":[{"in":"path","name":"conversationId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantSessionControlInput"}}}},"responses":{"200":{"description":"Sesión terminada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAssistantSessionSuccess"}}}}}}},"/assistant/conversations/{conversationId}/session/retry":{"post":{"operationId":"retryConversationAssistantSession","summary":"Reintentar una actividad terminal fallida del Assistant","tags":["Assistant"],"parameters":[{"in":"path","name":"conversationId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantSessionControlInput"}}}},"responses":{"200":{"description":"Actividad encolada nuevamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAssistantSessionSuccess"}}}},"409":{"description":"Versión obsoleta o actividad no reintentable."}}}},"/assistant/knowledge-gaps":{"get":{"operationId":"listKnowledgeGaps","summary":"Listar sugerencias de conocimiento detectadas por IA","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["suggested","resolved","dismissed"]}},{"in":"query","name":"capability","schema":{"type":"string","enum":["general","knowledge_base","products","orders"]}},{"in":"query","name":"assistant_id","schema":{"type":"string"}}],"responses":{"200":{"description":"Sugerencias de conocimiento.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGapListSuccess"}}}}}}},"/assistant/knowledge-gaps/{id}/resolve":{"post":{"operationId":"resolveKnowledgeGap","summary":"Resolver una sugerencia enlazando conocimiento existente","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGapResolveInput"}}}},"responses":{"200":{"description":"Sugerencia resuelta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGapSuccess"}}}},"404":{"description":"Sugerencia o fuente no encontrada."},"409":{"description":"Versión obsoleta."}}}},"/assistant/knowledge-gaps/{id}/dismiss":{"post":{"operationId":"dismissKnowledgeGap","summary":"Descartar una sugerencia de conocimiento","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGapReviewInput"}}}},"responses":{"200":{"description":"Sugerencia descartada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGapSuccess"}}}},"404":{"description":"Sugerencia no encontrada."},"409":{"description":"Versión obsoleta."}}}},"/assistant/knowledge-gaps/{id}/convert":{"post":{"operationId":"convertKnowledgeGap","summary":"Convertir una sugerencia en borrador de conocimiento","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGapConvertInput"}}}},"responses":{"201":{"description":"Borrador creado y sugerencia resuelta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGapConvertSuccess"}}}},"404":{"description":"Sugerencia no encontrada."},"409":{"description":"Versión obsoleta o nombre duplicado."}}}},"/assistant/decision-tables":{"get":{"operationId":"listDecisionTables","summary":"Listar tablas de decisión del Workspace","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Tablas de decisión.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTableListSuccess"}}}}}},"post":{"operationId":"createDecisionTable","summary":"Crear tabla de decisión","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTableInput"}}}},"responses":{"201":{"description":"Tabla creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTableSuccess"}}}},"409":{"description":"Nombre duplicado."}}}},"/assistant/decision-tables/{id}":{"get":{"operationId":"getDecisionTable","summary":"Consultar tabla de decisión","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Tabla encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTableSuccess"}}}},"404":{"description":"No encontrada."}}},"delete":{"operationId":"archiveDecisionTable","summary":"Archivar tabla de decisión","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Tabla archivada."},"404":{"description":"No encontrada."}}}},"/assistant/decision-tables/{id}/draft":{"put":{"operationId":"replaceDecisionTableDraft","summary":"Reemplazar borrador de tabla de decisión","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTableDraftReplaceInput"}}}},"responses":{"200":{"description":"Borrador actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTableSuccess"}}}},"409":{"description":"Revisión obsoleta."}}}},"/assistant/decision-tables/{id}/publish":{"post":{"operationId":"publishDecisionTable","summary":"Publicar versión de tabla de decisión","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTablePublishInput"}}}},"responses":{"201":{"description":"Versión publicada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTableVersionSuccess"}}}},"409":{"description":"Revisión obsoleta."},"422":{"description":"Tabla inválida.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTableValidationError"}}}}}}},"/assistant/decision-tables/{id}/versions":{"get":{"operationId":"listDecisionTableVersions","summary":"Listar versiones publicadas de una tabla de decisión","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Versiones publicadas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionTableVersionListSuccess"}}}}}}},"/assistant/knowledge-sources":{"get":{"operationId":"listKnowledgeSources","summary":"Listar fuentes de conocimiento del Workspace","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"type","schema":{"type":"string","enum":["faq","location","product","document"]}}],"responses":{"200":{"description":"Fuentes de conocimiento.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceListSuccess"}}}}}},"post":{"operationId":"createKnowledgeSource","summary":"Crear fuente de conocimiento","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceInput"}}}},"responses":{"201":{"description":"Fuente creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceSuccess"}}}},"409":{"description":"Nombre duplicado."}}}},"/assistant/knowledge-sources/{id}":{"get":{"operationId":"getKnowledgeSource","summary":"Consultar fuente de conocimiento","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Fuente encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceSuccess"}}}},"404":{"description":"No encontrada."}}},"delete":{"operationId":"archiveKnowledgeSource","summary":"Archivar fuente de conocimiento","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Fuente archivada."},"404":{"description":"No encontrada."}}}},"/assistant/knowledge-sources/{id}/draft":{"put":{"operationId":"replaceKnowledgeSourceDraft","summary":"Reemplazar borrador de conocimiento","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceDraftReplaceInput"}}}},"responses":{"200":{"description":"Borrador actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceSuccess"}}}},"409":{"description":"Revisión obsoleta."}}}},"/assistant/knowledge-sources/{id}/publish":{"post":{"operationId":"publishKnowledgeSource","summary":"Publicar versión de conocimiento","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourcePublishInput"}}}},"responses":{"201":{"description":"Versión publicada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceVersionSuccess"}}}},"409":{"description":"Revisión obsoleta."}}}},"/assistant/knowledge-sources/{id}/versions":{"get":{"operationId":"listKnowledgeSourceVersions","summary":"Listar historial publicado de conocimiento","tags":["Assistant"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Versiones publicadas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceVersionListSuccess"}}}}}}},"/assistant/flows":{"get":{"operationId":"listDialogFlows","summary":"Listar flujos de diálogo del Workspace","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Flujos activos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowListSuccess"}}}},"403":{"description":"Workspace no autorizado o herramienta assistant deshabilitada."}}},"post":{"operationId":"createDialogFlow","summary":"Crear borrador de flujo","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowCreateInput"}}}},"responses":{"201":{"description":"Borrador creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowSuccess"}}}},"403":{"description":"Se requiere administrador y herramienta assistant."},"409":{"description":"Nombre duplicado en el Workspace."}}}},"/assistant/flows/{id}":{"get":{"operationId":"getDialogFlow","summary":"Obtener flujo y borrador actual","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Flujo encontrado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowSuccess"}}}},"404":{"description":"Flujo no encontrado en el scope."}}},"delete":{"operationId":"archiveDialogFlow","summary":"Archivar flujo","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Flujo archivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowArchiveSuccess"}}}},"403":{"description":"Se requiere administrador."},"404":{"description":"Flujo no encontrado."}}}},"/assistant/flows/{id}/design":{"post":{"operationId":"designDialogFlow","summary":"Proponer un flujo o fragmento con IA","description":"Genera una propuesta validada sin modificar el draft. El usuario debe revisarla, aplicarla y guardar explícitamente.","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowDesignInput"}}}},"responses":{"200":{"description":"Propuesta lista para revisión local.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowDesignSuccess"}}}},"403":{"description":"Se requiere administrador y herramienta assistant."},"404":{"description":"Flow no encontrado en el Workspace."},"422":{"description":"El output o la propuesta no forman un grafo válido.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowDesignError"}}}},"429":{"description":"Se alcanzó un límite de ejecución o del proveedor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowDesignError"}}}},"503":{"description":"El proveedor o modelo de IA no está disponible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowDesignError"}}}},"504":{"description":"La generación excedió el tiempo disponible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowDesignError"}}}}}}},"/assistant/flows/{id}/assets/prepare":{"post":{"operationId":"prepareDialogFlowAssetUpload","summary":"Preparar carga privada de multimedia para un Flow","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowAssetPrepareInput"}}}},"responses":{"201":{"description":"URL V4 firmada y metadata pendiente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowAssetPrepareSuccess"}}}},"403":{"description":"Se requiere administrar Assistant."},"404":{"description":"Flow no encontrado en el Workspace."},"422":{"description":"Tipo o tamaño incompatible con WhatsApp."}}}},"/assistant/flows/{id}/assets/{assetId}/complete":{"post":{"operationId":"completeDialogFlowAssetUpload","summary":"Validar y completar una carga multimedia","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"assetId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Asset privado validado y listo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowAssetSuccess"}}}},"404":{"description":"Flow o asset no encontrado en el scope."},"422":{"description":"MIME, tamaño, firma o codec inválido."}}}},"/assistant/flows/{id}/assets/{assetId}/content":{"get":{"operationId":"getDialogFlowAssetContent","summary":"Leer multimedia privada para preview","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"assetId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Contenido binario autenticado.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Asset no encontrado o no listo."}}}},"/assistant/flows/{id}/assets/{assetId}/cancel":{"post":{"operationId":"cancelDialogFlowAssetUpload","summary":"Cancelar una carga multimedia","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"assetId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Carga cancelada y metadata archivada."},"409":{"description":"El asset está referenciado."}}}},"/assistant/flows/{id}/assets/{assetId}":{"delete":{"operationId":"archiveDialogFlowAsset","summary":"Archivar multimedia no referenciada","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"assetId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Asset archivado."},"404":{"description":"Asset no encontrado en el scope."},"409":{"description":"El draft o una versión publicada todavía lo referencia."}}}},"/assistant/flows/{id}/draft":{"put":{"operationId":"replaceDialogFlowDraft","summary":"Reemplazar borrador con control optimista","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowDraftReplaceInput"}}}},"responses":{"200":{"description":"Borrador actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowSuccess"}}}},"409":{"description":"Revisión obsoleta o nombre duplicado."}}}},"/assistant/flows/{id}/publish":{"post":{"operationId":"publishDialogFlow","summary":"Validar y publicar snapshot inmutable","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowPublishInput"}}}},"responses":{"200":{"description":"Versión publicada o replay idempotente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowVersionSuccess"}}}},"409":{"description":"La revisión del borrador quedó obsoleta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowValidationError"}}}},"422":{"description":"Grafo inválido o módulos requeridos no disponibles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowValidationError"}}}}}}},"/assistant/flows/{id}/versions":{"get":{"operationId":"listDialogFlowVersions","summary":"Listar snapshots publicados","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Versiones inmutables.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowVersionListSuccess"}}}}}}},"/assistant/flows/{id}/versions/{version}":{"get":{"operationId":"getDialogFlowVersion","summary":"Obtener snapshot publicado","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"path","name":"version","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Versión encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialogFlowVersionSuccess"}}}},"404":{"description":"Versión no encontrada en el scope."}}}},"/assistant/assistants/{id}/simulate":{"post":{"operationId":"simulateAssistant","summary":"Simular un Assistant activo con su Flow publicado y sin efectos externos","tags":["Assistant"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantSimulationInput"}}}},"responses":{"200":{"description":"Conversación aislada con la configuración real del Assistant y trace reproducible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantSimulationSuccess"}}}},"403":{"description":"Solo administradores pueden ejecutar simulaciones con IA."},"404":{"description":"Assistant activo o Flow publicado no encontrado en el Workspace."},"429":{"description":"Límite de simulaciones excedido."}}}},"/cases/custom-fields":{"get":{"operationId":"listCaseCustomFields","summary":"Listar definiciones de campos personalizados de Tickets","tags":["Ticket Custom Fields"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Definiciones activas y ordenadas del Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCustomFieldListSuccess"}}}},"403":{"description":"Workspace no autorizado o Tickets deshabilitado."}}},"post":{"operationId":"createCaseCustomField","summary":"Crear definición de campo personalizado de Tickets","tags":["Ticket Custom Fields"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCustomFieldCreateInput"}}}},"responses":{"201":{"description":"Definición creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCustomFieldSuccess"}}}},"400":{"description":"Tipo, reglas, opciones o tipos de Ticket inválidos."},"409":{"description":"La key técnica ya existe en el Workspace."}}}},"/cases/custom-fields/{id}":{"get":{"operationId":"getCaseCustomField","summary":"Obtener definición de campo personalizado de Tickets","tags":["Ticket Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Definición encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCustomFieldSuccess"}}}},"404":{"description":"Definición no encontrada en el Workspace."}}},"put":{"operationId":"updateCaseCustomField","summary":"Actualizar definición sin cambiar su key ni tipo","tags":["Ticket Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCustomFieldUpdateInput"}}}},"responses":{"200":{"description":"Definición actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCustomFieldSuccess"}}}},"400":{"description":"Reglas, opciones o tipos de Ticket inválidos."},"404":{"description":"Definición no encontrada en el Workspace."}}},"delete":{"operationId":"archiveCaseCustomField","summary":"Archivar definición conservando valores históricos","tags":["Ticket Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Definición archivada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCustomFieldArchiveSuccess"}}}},"404":{"description":"Definición no encontrada en el Workspace."}}}},"/cases/configuration":{"get":{"operationId":"getCaseConfiguration","summary":"Obtener tipos, estados globales y embudos de Tickets","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Configuración operativa del Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseConfigurationSuccess"}}}},"403":{"description":"Workspace no autorizado."}}}},"/cases/configuration/types":{"post":{"operationId":"createCaseType","summary":"Crear tipo de Ticket","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseTypeInput"}}}},"responses":{"201":{"description":"Tipo creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseTypeSuccess"}}}},"403":{"description":"Se requiere rol admin."}}}},"/cases/configuration/types/{id}":{"put":{"operationId":"updateCaseType","summary":"Actualizar tipo de Ticket","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseTypeInput"}}}},"responses":{"200":{"description":"Tipo actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseTypeSuccess"}}}},"403":{"description":"Se requiere rol admin."},"404":{"description":"Tipo no encontrado."}}}},"/cases/configuration/labels":{"post":{"operationId":"createCaseLabel","summary":"Crear etiqueta de Ticket","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseLabelInput"}}}},"responses":{"201":{"description":"Etiqueta creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseLabelSuccess"}}}},"403":{"description":"Se requiere cases.manage."},"409":{"description":"Ya existe una etiqueta con ese nombre."}}}},"/cases/configuration/labels/{id}":{"put":{"operationId":"updateCaseLabel","summary":"Actualizar etiqueta de Ticket","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseLabelInput"}}}},"responses":{"200":{"description":"Etiqueta actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseLabelSuccess"}}}},"403":{"description":"Se requiere cases.manage."},"404":{"description":"Etiqueta no encontrada."},"409":{"description":"Nombre duplicado o etiqueta en uso."}}}},"/cases/configuration/outcome-reasons":{"post":{"operationId":"createCaseOutcomeReason","summary":"Crear motivo de resultado de Tickets","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseOutcomeReasonInput"}}}},"responses":{"201":{"description":"Motivo creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseOutcomeReasonSuccess"}}}},"403":{"description":"Se requiere cases.manage."},"409":{"description":"El código o nombre ya existe."}}}},"/cases/configuration/outcome-reasons/{id}":{"put":{"operationId":"updateCaseOutcomeReason","summary":"Actualizar motivo de resultado de Tickets","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseOutcomeReasonInput"}}}},"responses":{"200":{"description":"Motivo actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseOutcomeReasonSuccess"}}}},"403":{"description":"Se requiere cases.manage."},"404":{"description":"Motivo no encontrado."},"409":{"description":"El código no puede cambiar o el nombre ya existe."}}},"delete":{"operationId":"archiveCaseOutcomeReason","summary":"Archivar motivo de resultado conservando historial","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Motivo archivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseConfigurationArchiveSuccess"}}}},"403":{"description":"Se requiere cases.manage."},"404":{"description":"Motivo no encontrado."}}}},"/cases/configuration/states":{"post":{"operationId":"createCaseState","summary":"Crear estado global de Tickets","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseStateInput"}}}},"responses":{"201":{"description":"Estado creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseStateSuccess"}}}},"403":{"description":"Se requiere rol admin."}}}},"/cases/configuration/states/{id}":{"put":{"operationId":"updateCaseState","summary":"Actualizar estado global de Tickets","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseStateInput"}}}},"responses":{"200":{"description":"Estado actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseStateSuccess"}}}},"403":{"description":"Se requiere rol admin."},"404":{"description":"Estado no encontrado."},"409":{"description":"El estado está en uso."}}}},"/cases/configuration/funnels":{"post":{"operationId":"createCaseFunnel","summary":"Crear Embudo como vista ordenada de estados","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseFunnelInput"}}}},"responses":{"201":{"description":"Embudo creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseFunnelSuccess"}}}},"403":{"description":"Se requiere rol admin."}}}},"/cases/configuration/funnels/{id}":{"put":{"operationId":"updateCaseFunnel","summary":"Actualizar estados, orden y filtros del Embudo","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseFunnelInput"}}}},"responses":{"200":{"description":"Embudo actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseFunnelSuccess"}}}},"403":{"description":"Se requiere rol admin."},"404":{"description":"Embudo no encontrado."}}}},"/cases/configuration/{kind}/{id}":{"delete":{"operationId":"archiveCaseConfigurationItem","summary":"Archivar configuración de Tickets sin referencias","tags":["Tickets"],"parameters":[{"in":"path","name":"kind","required":true,"schema":{"type":"string","enum":["type","state","funnel"]}},{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Elemento archivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseConfigurationArchiveSuccess"}}}},"403":{"description":"Se requiere rol admin."},"409":{"description":"El elemento está en uso o es predeterminado."}}}},"/orders/kanbans":{"get":{"operationId":"listOrdersKanbans","summary":"Listar Kanbans de órdenes","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Kanbans y columnas configuradas para Orders.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrdersKanbanListSuccess"}}}},"403":{"description":"Órdenes no está habilitado o el Workspace no está autorizado."}}}},"/orders/orders":{"get":{"operationId":"listOrdersOrders","summary":"Listar Orders del Workspace","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"in":"query","name":"kanban_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"column_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"contact_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"conversation_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"responsible_user_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"fulfillment_priority","schema":{"type":"string","enum":["low","normal","high","urgent"]}},{"in":"query","name":"status","schema":{"type":"string","enum":["open","closed"]}},{"in":"query","name":"classification","schema":{"type":"string","enum":["resolved","cancelled","duplicate"]}},{"in":"query","name":"search","schema":{"type":"string","minLength":1,"maxLength":100}}],"responses":{"200":{"description":"Orders visibles en el Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderListSuccess"}}}},"403":{"description":"Órdenes no está habilitado o el Workspace no está autorizado."}}},"post":{"operationId":"createOrdersOrder","summary":"Crear Order","description":"Crea un Order en una columna abierta y lo vincula a su Contacto y conversación opcional.","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderCreateInput"}}}},"responses":{"201":{"description":"Order creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderSuccess"}}}},"400":{"description":"Referencia o campo inválido."},"403":{"description":"Órdenes no está habilitado o el Workspace no está autorizado."},"409":{"description":"La conversación cambió concurrentemente."}}}},"/orders/orders/kanban":{"get":{"operationId":"getOrdersOrderKanban","summary":"Cargar Kanban de Orders","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"kanban_id","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"search","schema":{"type":"string","minLength":1,"maxLength":100}},{"in":"query","name":"responsible_user_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"fulfillment_priority","schema":{"type":"string","enum":["low","normal","high","urgent"]}},{"in":"query","name":"status","schema":{"type":"string","enum":["open","closed"]}},{"in":"query","name":"classification","schema":{"type":"string","enum":["resolved","cancelled","duplicate"]}},{"in":"query","name":"limit_per_column","schema":{"type":"integer","minimum":1,"maximum":50,"default":30}}],"responses":{"200":{"description":"Columnas, conteos y Orders del Kanban.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderBoardSuccess"}}}},"400":{"description":"Filtro o Kanban inválido."},"403":{"description":"Órdenes no está habilitado o el Workspace no está autorizado."}}}},"/orders/orders/{id}":{"get":{"operationId":"getOrdersOrder","summary":"Obtener Order","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Order encontrado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderSuccess"}}}},"400":{"description":"ID de Order inválido."},"404":{"description":"Order no encontrado en el Workspace."}}},"patch":{"operationId":"updateOrdersOrder","summary":"Actualizar Order abierto","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderUpdateInput"}}}},"responses":{"200":{"description":"Order actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderSuccess"}}}},"400":{"description":"Campo inválido o Order cerrado."},"404":{"description":"Order no encontrado."},"409":{"description":"El Order cambió concurrentemente."}}},"delete":{"operationId":"archiveOrdersOrder","summary":"Archivar Order cerrado","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Order archivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderArchiveSuccess"}}}},"400":{"description":"El Order debe estar cerrado."},"404":{"description":"Order no encontrado."}}}},"/orders/orders/{id}/transitions":{"get":{"operationId":"listOrdersOrderTransitions","summary":"Listar actividad de transición del Order","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Historial append-only del Order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderTransitionListSuccess"}}}},"404":{"description":"Order no encontrado."}}},"post":{"operationId":"transitionOrdersOrder","summary":"Mover Order de forma atómica e idempotente","description":"Una columna terminal aplica Resuelto, Cancelado o Duplicado y cierra el Order.","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderTransitionInput"}}}},"responses":{"200":{"description":"Replay idempotente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderTransitionSuccess"}}}},"201":{"description":"Transición aplicada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderTransitionSuccess"}}}},"400":{"description":"Transición inválida."},"404":{"description":"Order no encontrado."},"409":{"description":"Versión obsoleta."}}}},"/orders/orders/{id}/reopen":{"post":{"operationId":"reopenOrdersOrder","summary":"Reabrir Order con auditoría","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderReopenInput"}}}},"responses":{"200":{"description":"Replay idempotente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderTransitionSuccess"}}}},"201":{"description":"Order reabierto.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderTransitionSuccess"}}}},"403":{"description":"Se requiere rol admin."},"409":{"description":"Versión obsoleta."}}}},"/orders/orders/{id}/conversations":{"post":{"operationId":"linkOrdersOrderConversation","summary":"Vincular conversación y activar su contexto de Order","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderConversationLinkInput"}}}},"responses":{"200":{"description":"Conversación vinculada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderSuccess"}}}},"400":{"description":"El Contacto de la conversación no coincide."},"404":{"description":"Order no encontrado."},"409":{"description":"La conversación cambió concurrentemente."}}}},"/cases":{"get":{"summary":"Listar Tickets del Workspace autorizado","description":"Consulta paginada con filtros combinables y tenant-scoped.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"in":"query","name":"type_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"state_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"contact_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"responsible_user_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}}],"responses":{"200":{"description":"Cases activos del Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseListSuccess"}}}},"403":{"description":"Workspace no autorizado."}}},"post":{"summary":"Crear Ticket en un estado abierto","description":"Disponible para miembros activos. Si se omiten tipo y estado usa los predeterminados del Workspace.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCreateInput"}}}},"responses":{"201":{"description":"Case creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseSuccess"}}}},"400":{"description":"Referencia o atributo comercial inválido."},"403":{"description":"Se requiere membresía activa del Workspace."}}}},"/cases/funnel":{"get":{"operationId":"getCaseFunnelBoard","summary":"Cargar Embudo de Tickets","description":"El Embudo selecciona y ordena estados globales; un Ticket puede aparecer en varios Embudos sin duplicarse.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"funnel_id","required":true,"schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"search","schema":{"type":"string","minLength":1,"maxLength":100}},{"in":"query","name":"state_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"type_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"responsible_user_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"tag_ids","description":"ObjectIds de tags separados por coma; todos deben coincidir.","schema":{"type":"string"}},{"in":"query","name":"label_ids","description":"IDs de etiquetas de Ticket separados por coma; todos deben coincidir.","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["open","closed"]}},{"in":"query","name":"outcome","schema":{"type":"string","enum":["won","lost"]}},{"in":"query","name":"created_from","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"created_to","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"source","schema":{"type":"string","enum":["direct","organic","paid","referral","social","email","partner","offline","other"]}},{"in":"query","name":"limit_per_state","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}},{"in":"query","name":"cursor","description":"Cursor opaco retornado por un estado.","schema":{"type":"string","maxLength":512}}],"responses":{"200":{"description":"Proyección de Embudo tenant-scoped.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseFunnelBoardSuccess"}}}},"400":{"description":"Filtros o cursor inválidos."},"403":{"description":"Workspace no autorizado."},"404":{"description":"Embudo no encontrado en el scope autorizado."}}}},"/cases/inbound-capture-policy":{"get":{"summary":"Obtener política de captura automática de Tickets","description":"Disponible para administradores del Workspace.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Política actual y versión de configuración.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundCaseCapturePolicySuccess"}}}},"403":{"description":"Se requiere rol admin."}}},"put":{"summary":"Configurar captura automática desde mensajes entrantes","description":"Valida módulos habilitados y que el tipo y estado iniciales pertenezcan al Workspace; el estado debe ser abierto.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundCaseCapturePolicyInput"}}}},"responses":{"200":{"description":"Política actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundCaseCapturePolicySuccess"}}}},"400":{"description":"Tools o referencias de captura inválidas."},"403":{"description":"Se requiere rol admin."},"409":{"description":"Versión de configuración obsoleta."}}}},"/cases/{id}":{"get":{"summary":"Obtener Case del Workspace autorizado","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/ObjectIdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Case encontrado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseSuccess"}}}},"400":{"description":"ID de Case inválido."},"404":{"description":"Case no encontrado en el scope autorizado."}}},"patch":{"summary":"Editar atributos comerciales no relacionados al lifecycle","description":"Disponible para miembros activos. Rechaza column_id, kanban_id, Workspace, status, outcome y closed_at.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseUpdateInput"}}}},"responses":{"200":{"description":"Case actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseSuccess"}}}},"400":{"description":"Campo inmutable o atributo incoherente."},"404":{"description":"Case no encontrado."},"409":{"description":"El Case está cerrado y es inmutable."}}},"delete":{"summary":"Archivar Case","description":"Soft delete disponible para miembros activos del Workspace.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Case archivado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseArchiveSuccess"}}}},"404":{"description":"Case no encontrado."},"409":{"description":"El Case está cerrado y es inmutable."}}}},"/cases/{id}/notes":{"get":{"operationId":"listCaseNotes","summary":"Listar notas internas del Ticket","description":"Devuelve solo notas internas asociadas al Ticket dentro del Workspace y alcance visible del actor.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Notas internas del Ticket.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteListSuccess"}}}},"403":{"description":"Falta permiso para consultar notas internas."},"404":{"description":"Ticket no encontrado en el alcance visible."}}},"post":{"operationId":"createCaseNote","summary":"Añadir nota interna al Ticket","description":"Resuelve el contacto y la conversación vinculada desde el Ticket; esos identificadores no se aceptan desde el cliente.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteCreateInput"}}}},"responses":{"201":{"description":"Nota interna creada y auditada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteSuccess"}}}},"403":{"description":"Falta permiso para crear notas internas."},"404":{"description":"Ticket no encontrado en el alcance visible."}}}},"/cases/{id}/notes/{noteId}":{"patch":{"operationId":"updateCaseNote","summary":"Editar una nota interna del Ticket","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"noteId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteUpdateInput"}}}},"responses":{"200":{"description":"Nota interna actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteSuccess"}}}},"403":{"description":"Solo el autor o un administrador de notas puede editarla."},"404":{"description":"Ticket o nota no encontrados en el alcance visible."},"409":{"description":"La versión esperada quedó obsoleta."}}},"delete":{"operationId":"deleteCaseNote","summary":"Eliminar lógicamente una nota interna del Ticket","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"noteId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"expected_version","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Nota interna eliminada con auditoría conservada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteDeleteSuccess"}}}},"403":{"description":"Solo el autor o un administrador de notas puede eliminarla."},"404":{"description":"Ticket o nota no encontrados en el alcance visible."},"409":{"description":"La versión esperada quedó obsoleta."}}}},"/cases/{id}/custom-fields":{"get":{"operationId":"listCaseCustomFieldValues","summary":"Listar valores personalizados del Ticket con sus definiciones","tags":["Ticket Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Valores actuales, incluidas definiciones archivadas históricas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCustomFieldCollectionSuccess"}}}},"404":{"description":"Ticket no encontrado en el Workspace."}}},"put":{"operationId":"replaceCaseCustomFieldValues","summary":"Reemplazar valores personalizados del Ticket de forma atómica","tags":["Ticket Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCustomFieldAssignmentInput"}}}},"responses":{"200":{"description":"Valores validados y reemplazados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseSuccess"}}}},"400":{"description":"Definición, aplicabilidad, regla o valor inválido."},"404":{"description":"Ticket no encontrado en el Workspace."},"409":{"description":"Versión del Ticket obsoleta."}}}},"/cases/{id}/assignment":{"patch":{"operationId":"assignCase","summary":"Asignar un Ticket a un equipo y asesor","description":"Requiere permiso de asignación. Si el Ticket tiene una conversación vinculada, la conversación es la fuente canónica y proyecta el resultado al Ticket.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseAssignmentInput"}}}},"responses":{"200":{"description":"Ticket reasignado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseSuccess"}}}},"400":{"description":"Equipo o asesor inválido."},"403":{"description":"El actor no posee permiso de asignación."},"404":{"description":"Ticket no encontrado en el alcance visible."},"409":{"description":"Versión obsoleta o Ticket cerrado."}}}},"/cases/outcome-metrics":{"get":{"operationId":"getCaseOutcomeMetrics","summary":"Medir cierres y motivos de resultado del Workspace","description":"Cuenta cada transición terminal por occurred_at. Una reapertura seguida de otro cierre cuenta como un nuevo cierre; los históricos sin motivo se reportan como unclassified y nunca se infieren.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"from","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"to","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Métricas con denominadores y políticas explícitas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseOutcomeMetricsSuccess"}}}},"403":{"description":"Requiere lectura global de Cases o cases.manage."}}}},"/cases/{id}/transitions":{"get":{"summary":"Listar historial append-only de transiciones del Case","description":"Devuelve transiciones tenant-scoped en orden descendente y sin PII comercial.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Historial de transiciones.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseTransitionListSuccess"}}}},"404":{"description":"Case no encontrado en el scope autorizado."}}},"post":{"summary":"Transicionar Case de forma atómica e idempotente","description":"Aplica control optimista por version y cierra el Case al entrar a una columna terminal.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseTransitionInput"}}}},"responses":{"200":{"description":"Transición aplicada o replay idempotente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseTransitionSuccess"}}}},"400":{"description":"Columna incompatible o transición inválida."},"404":{"description":"Case no encontrado en el scope autorizado."},"409":{"description":"Version obsoleta, idempotency key incompatible o Case cerrado."}}}},"/cases/{id}/outcome-suggestions":{"post":{"operationId":"suggestCaseOutcomeReason","summary":"Sugerir motivos de resultado con IA y evidencia verificable","description":"Nunca cierra el Ticket. Devuelve únicamente candidatos del catálogo activo; baja confianza y ausencia de evidencia se reportan explícitamente para decisión humana.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseInsightRequest"}}}},"responses":{"201":{"description":"Sugerencia persistida y auditable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseOutcomeSuggestionSuccess"}}}},"400":{"description":"Ticket cerrado, sin conversación o contexto insuficiente."},"404":{"description":"Ticket no visible."}}}},"/cases/{id}/outcome-suggestions/{suggestionId}/reject":{"post":{"operationId":"rejectCaseOutcomeSuggestion","summary":"Descartar una sugerencia de motivo","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"suggestionId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Sugerencia descartada y auditada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseOutcomeSuggestionSuccess"}}}},"404":{"description":"Sugerencia no encontrada."},"409":{"description":"La sugerencia ya fue decidida."}}}},"/cases/{id}/objections":{"get":{"operationId":"listCaseObjections","summary":"Listar ocurrencias de objeción del Ticket","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Timeline de objeciones, incluidas detecciones pendientes y descartadas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseObjectionOccurrenceListSuccess"}}}}}},"post":{"operationId":"createCaseObjection","summary":"Registrar manualmente una ocurrencia de objeción","description":"No cambia el estado ni cierra el Ticket.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseObjectionCreateInput"}}}},"responses":{"201":{"description":"Objeción registrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseObjectionOccurrenceSuccess"}}}}}}},"/cases/{id}/objections/detect":{"post":{"operationId":"detectCaseObjections","summary":"Detectar objeciones con IA para confirmación humana","description":"Crea ocurrencias pending de forma idempotente; solo usa definiciones activas y evidencia de la conversación vinculada.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseInsightRequest"}}}},"responses":{"201":{"description":"Detección completada, incluso si no hubo candidatos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseObjectionOccurrenceListSuccess"}}}}}}},"/cases/{id}/objections/{occurrenceId}":{"patch":{"operationId":"reviewCaseObjection","summary":"Confirmar, corregir o descartar una objeción y actualizar su resolución","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"occurrenceId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseObjectionReviewInput"}}}},"responses":{"200":{"description":"Revisión aplicada con control optimista.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseObjectionOccurrenceSuccess"}}}},"409":{"description":"Versión obsoleta o ocurrencia descartada."}}}},"/cases/{id}/reopen":{"post":{"summary":"Reabrir un Case cerrado hacia una etapa activa","description":"Operación admin-only, atómica e idempotente. Limpia resultado y fecha de cierre, incrementa la versión y conserva evidencia de transición.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseReopenInput"}}}},"responses":{"200":{"description":"Case reabierto o replay idempotente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseTransitionSuccess"}}}},"400":{"description":"Etapa de destino terminal o reapertura inválida."},"403":{"description":"Se requiere rol admin."},"404":{"description":"Case no encontrado en el scope autorizado."},"409":{"description":"Versión obsoleta o idempotency key incompatible."}}}},"/cases/{id}/attribution-events":{"get":{"summary":"Listar timeline append-only de atribución del Case","description":"Devuelve AttributionEvents tenant-scoped en orden temporal descendente.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Timeline de atribución.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributionEventListSuccess"}}}},"404":{"description":"Case no encontrado en el scope autorizado."}}},"post":{"summary":"Registrar AttributionEvent de forma append-only","description":"Normaliza campos estructurados y aplica idempotencia cuando se proporciona external_key.","tags":["Tickets"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributionEventInput"}}}},"responses":{"200":{"description":"Replay idempotente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributionEventSuccess"}}}},"201":{"description":"AttributionEvent registrado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributionEventSuccess"}}}},"400":{"description":"Payload de atribución inválido."},"404":{"description":"Case no encontrado en el scope autorizado."},"409":{"description":"external_key reutilizada con datos diferentes."}}}},"/audit-logs":{"get":{"summary":"Listar auditoria visible del Business o Workspace","tags":["Audit Logs"],"parameters":[{"$ref":"#/components/parameters/OptionalWorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"in":"query","name":"action","schema":{"type":"string"}},{"in":"query","name":"resource_type","schema":{"type":"string"}},{"in":"query","name":"resource_id","schema":{"type":"string"}}],"responses":{"200":{"description":"Audit logs append-only en orden descendente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditLogListSuccess"},"example":{"success":true,"data":[{"_id":"667400000f8a4f0012c3d444","business_id":"665a9f9f0f8a4f0012c3d456","actor_user_id":"665aa0040f8a4f0012c3d457","visibility":"business","action":"person.updated","resource_type":"contact","resource_id":"665b1a3f0f8a4f0012c3d500","metadata":{"fields":["name"]},"occurred_at":"2026-07-16T15:00:00.000Z"}],"meta":{"total":1,"page":1,"limit":20,"total_pages":1}}}}},"403":{"description":"Contexto Business o Workspace no autorizado."}}}},"/api-keys/keys":{"post":{"summary":"Crear API key","tags":["API Keys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"name":"Frontend Dashboard Key","scopes":["contacts:read","payment_coupons:read","settlements:read"]}}}},"responses":{"201":{"description":"Recurso creado correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"666a00040f8a4f0012c3d700","business_id":"665a9f9f0f8a4f0012c3d456","name":"Frontend Dashboard Key","key_preview":"sk_live_xxxxxxxx","scopes":["contacts:read","payment_coupons:read","settlements:read"],"active":true,"created_at":"2026-06-13T09:00:00.000Z"},"message":"Recurso creado correctamente"}}}}}},"get":{"summary":"Listar API keys","tags":["API Keys"],"responses":{"200":{"description":"Listado obtenido correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericListSuccess"},"example":{"success":true,"data":[{"_id":"666a00040f8a4f0012c3d700","business_id":"665a9f9f0f8a4f0012c3d456","name":"Frontend Dashboard Key","key_preview":"sk_live_xxxxxxxx","scopes":["contacts:read","payment_coupons:read","settlements:read"],"active":true,"created_at":"2026-06-13T09:00:00.000Z"}],"meta":{"page":1,"limit":10,"total":1,"total_pages":1}}}}}}}},"/api-keys/keys/{keyId}":{"delete":{"summary":"Revocar API key","tags":["API Keys"],"parameters":[{"$ref":"#/components/parameters/KeyIdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/businesses/me":{"get":{"operationId":"getMyBusinesses","summary":"Obtener negocios autorizados y negocio activo","tags":["Businesses"],"responses":{"200":{"description":"Negocios autorizados y selección activa del usuario.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppBusinessesMeSuccess"}}}},"503":{"description":"Las asociaciones no pudieron resolverse de forma consistente o la persistencia está temporalmente saturada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericError"}}}}}}},"/businesses/{id}":{"get":{"summary":"Obtener negocio por ID","tags":["Businesses"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}},"put":{"summary":"Actualizar negocio por ID","tags":["Businesses"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppBusinessUpdateInput"},"example":{"name":"Comercio Demo SAC","email":"operaciones@comercio.pe","phone":"+51 999 123 456","address":"Av. Primavera 1234, Lima"}}}},"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/workspaces":{"get":{"summary":"Listar workspaces autorizados","tags":["Workspaces"],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"in":"query","name":"status","schema":{"type":"string","enum":["active","inactive","archived"]}}],"responses":{"200":{"description":"Listado obtenido correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericListSuccess"},"example":{"success":true,"data":[{"_id":"666f3b220f8a4f0012c3dabc","business_id":"665a9f9f0f8a4f0012c3d456","name":"Principal","description":"Workspace principal del negocio","purpose":"sales","primary_kanban_id":"666f3b220f8a4f0012c3dbcd","status":"active","onboarding_status":"completed","settings":{},"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-14T02:00:00.000Z","updated_at":"2026-07-14T02:00:00.000Z"}],"meta":{"page":1,"limit":10,"total":1,"total_pages":1}}}}}}},"post":{"summary":"Crear workspace","tags":["Workspaces"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceCreateInput"},"example":{"name":"Ventas Lima","description":"Equipo comercial Lima","purpose":"sales","settings":{"locale":"es-PE"}}}}},"responses":{"201":{"description":"Recurso creado correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceSuccess"},"example":{"success":true,"data":{"_id":"666f3b220f8a4f0012c3dabc","business_id":"665a9f9f0f8a4f0012c3d456","name":"Principal","description":"Workspace principal del negocio","purpose":"sales","primary_kanban_id":"666f3b220f8a4f0012c3dbcd","status":"active","onboarding_status":"completed","settings":{},"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-14T02:00:00.000Z","updated_at":"2026-07-14T02:00:00.000Z"}}}}}}}},"/workspaces/{workspaceId}":{"get":{"summary":"Obtener workspace por ID","tags":["Workspaces"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceSuccess"},"example":{"success":true,"data":{"_id":"666f3b220f8a4f0012c3dabc","business_id":"665a9f9f0f8a4f0012c3d456","name":"Principal","description":"Workspace principal del negocio","purpose":"sales","primary_kanban_id":"666f3b220f8a4f0012c3dbcd","status":"active","onboarding_status":"completed","settings":{},"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-14T02:00:00.000Z","updated_at":"2026-07-14T02:00:00.000Z"}}}}}}},"put":{"summary":"Actualizar workspace por ID","tags":["Workspaces"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceUpdateInput"},"example":{"name":"Ventas Lima Norte"}}}},"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceSuccess"},"example":{"success":true,"data":{"_id":"666f3b220f8a4f0012c3dabc","business_id":"665a9f9f0f8a4f0012c3d456","name":"Ventas Lima Norte","description":"Workspace principal del negocio","purpose":"sales","primary_kanban_id":"666f3b220f8a4f0012c3dbcd","status":"active","onboarding_status":"completed","settings":{},"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-14T02:00:00.000Z","updated_at":"2026-07-14T02:00:00.000Z"}}}}}}},"delete":{"summary":"Archivar workspace (soft delete)","description":"No archiva conexiones ni canales implícitamente. Los números deben transferirse o desconectarse antes de archivar.","tags":["Workspaces"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}},"409":{"description":"El Workspace todavía conserva canales activos o inactivos."}}}},"/workspaces/{workspaceId}/restore":{"post":{"summary":"Restaurar workspace archivado","tags":["Workspaces"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"666f3b220f8a4f0012c3dabc","business_id":"665a9f9f0f8a4f0012c3d456","name":"Principal","description":"Workspace principal del negocio","purpose":"sales","primary_kanban_id":"666f3b220f8a4f0012c3dbcd","status":"active","onboarding_status":"completed","settings":{},"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-14T02:00:00.000Z","updated_at":"2026-07-14T02:00:00.000Z"},"message":"Operacion exitosa"}}}}}}},"/workspaces/{workspaceId}/onboarding":{"get":{"summary":"Obtener configuración reanudable y plantillas de onboarding","tags":["Workspaces"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceOnboardingStateSuccess"},"example":{"success":true,"data":{"workspace":{"_id":"666f3b220f8a4f0012c3dabc","business_id":"665a9f9f0f8a4f0012c3d456","name":"Principal","description":"Workspace principal del negocio","purpose":"sales","primary_kanban_id":"666f3b220f8a4f0012c3dbcd","status":"active","onboarding_status":"completed","settings":{},"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-14T02:00:00.000Z","updated_at":"2026-07-14T02:00:00.000Z"},"templates":[],"goals":[]}}}}}}},"put":{"summary":"Configurar el primer kanban y activar el workspace","tags":["Workspaces"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceOnboardingCompleteInput"},"example":{"purpose":"sales","tool_ids":["cases","messaging"]}}}},"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceOnboardingStateSuccess"},"example":{"success":true,"data":{"workspace":{"_id":"666f3b220f8a4f0012c3dabc","business_id":"665a9f9f0f8a4f0012c3d456","name":"Principal","description":"Workspace principal del negocio","purpose":"sales","primary_kanban_id":"666f3b220f8a4f0012c3dbcd","status":"active","onboarding_status":"completed","settings":{},"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-14T02:00:00.000Z","updated_at":"2026-07-14T02:00:00.000Z"},"templates":[],"goals":[]}}}}}}}},"/workspaces/{workspaceId}/tools":{"get":{"summary":"Listar herramientas y estado del workspace","tags":["Workspaces"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"}],"responses":{"200":{"description":"Herramientas y estado del Workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceToolListSuccess"},"example":{"success":true,"data":[{"tool_id":"messaging","name":"Mensajería","state":{"status":"active","is_enabled":true}}]}}}},"409":{"description":"El Workspace todavía conserva canales activos o inactivos."}}}},"/workspaces/{workspaceId}/tools/{toolId}":{"put":{"summary":"Actualizar estado de una herramienta del workspace","tags":["Workspaces"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdPathParam"},{"$ref":"#/components/parameters/WorkspaceToolIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"status":"active"}}}},"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"tool_id":"messaging","status":"active","is_enabled":true},"message":"Operacion exitosa"}}}}}}},"/business-config":{"get":{"summary":"Obtener configuracion del negocio","tags":["Business Config"],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/persons":{"get":{"summary":"Listar personas","tags":["Persons"],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"in":"query","name":"tag_id","schema":{"type":"string"}},{"in":"query","name":"name","schema":{"type":"string"}},{"in":"query","name":"email","schema":{"type":"string"}},{"in":"query","name":"phone","schema":{"type":"string"}},{"in":"query","name":"document_type","schema":{"type":"string"}},{"in":"query","name":"document_number","schema":{"type":"string"}}],"responses":{"200":{"description":"Directorio paginado de personas activas del Business.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactListSuccess"}}}}}},"post":{"summary":"Crear persona","tags":["Persons"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCreateInput"},"example":{"name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678"}}}},"responses":{"201":{"description":"Persona creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSuccess"}}}},"409":{"description":"Una identidad normalizada ya pertenece a otra persona del negocio."}}}},"/persons/search":{"get":{"summary":"Buscar personas","tags":["Persons"],"parameters":[{"in":"query","name":"q","schema":{"type":"string"}},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}}],"responses":{"200":{"description":"Resultados paginados de la búsqueda.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactListSuccess"}}}}}}},"/persons/{id}":{"get":{"summary":"Obtener persona por ID","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Persona encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSuccess"}}}},"404":{"description":"Persona no encontrada."}}},"put":{"summary":"Actualizar persona por ID","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactUpdateInput"},"example":{"name":"Juan Perez Actualizado","phone":"+51911111222"}}}},"responses":{"200":{"description":"Persona actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSuccess"}}}},"404":{"description":"Persona no encontrada."},"409":{"description":"Una identidad normalizada ya pertenece a otra persona del negocio."}}},"delete":{"summary":"Archivar persona por ID","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Persona archivada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactArchiveSuccess"}}}},"404":{"description":"Persona no encontrada."}}}},"/persons/{id}/merge":{"post":{"summary":"Fusionar una persona duplicada en la persona destino","description":"Operacion admin-only, conservadora, transaccional y auditable. Rechaza identidades o custom fields incompatibles.","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactMergeInput"},"example":{"source_contact_id":"665b1a3f0f8a4f0012c3d501"}}}},"responses":{"200":{"description":"Personas fusionadas o replay idempotente confirmado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactMergeSuccess"}}}},"403":{"description":"Se requiere rol admin en el Business."},"404":{"description":"Persona origen o destino no encontrada."},"409":{"description":"Personas incompatibles, archivadas o merge ambiguo."}}}},"/persons/{id}/notes":{"get":{"operationId":"listContactNotes","summary":"Listar notas internas de una persona","description":"Devuelve solo notas del Workspace activo; nunca se exponen al cliente.","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Notas internas de la persona.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteListSuccess"}}}},"404":{"description":"Persona no encontrada."}}},"post":{"operationId":"createContactNote","summary":"Crear una nota interna para una persona","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteCreateInput"}}}},"responses":{"201":{"description":"Nota interna creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteSuccess"}}}},"404":{"description":"Persona no encontrada."}}}},"/persons/{id}/notes/{noteId}":{"patch":{"operationId":"updateContactNote","summary":"Editar una nota interna de una persona","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"noteId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteUpdateInput"}}}},"responses":{"200":{"description":"Nota interna actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteSuccess"}}}},"403":{"description":"Solo el autor o un administrador de notas puede editarla."},"409":{"description":"La versión cambió desde que se cargó la nota."}}},"delete":{"operationId":"deleteContactNote","summary":"Eliminar lógicamente una nota interna de una persona","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"path","name":"noteId","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"expected_version","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Nota interna eliminada lógicamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactNoteDeleteSuccess"}}}},"403":{"description":"Solo el autor o un administrador de notas puede eliminarla."},"409":{"description":"La versión cambió desde que se cargó la nota."}}}},"/persons/{id}/payment-coupons":{"get":{"summary":"Listar cupones de una persona","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Listado obtenido correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericListSuccess"},"example":{"success":true,"data":[{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"}],"meta":{"page":1,"limit":10,"total":1,"total_pages":1}}}}}}}},"/persons/{id}/activity":{"get":{"summary":"Listar actividad transversal de una persona","description":"Incluye actividad Business-global y de todos los Workspaces autorizados para el usuario.","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/OptionalWorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Timeline paginado en orden descendente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactActivityListSuccess"},"example":{"success":true,"data":[{"_id":"667100000f8a4f0012c3d111","business_id":"665a9f9f0f8a4f0012c3d456","contact_id":"665b1a3f0f8a4f0012c3d500","workspace_id":"666f3b220f8a4f0012c3dabc","actor_user_id":"665aa0040f8a4f0012c3d457","event_type":"person.updated","visibility":"workspace","data":{"changed_fields":["phone"]},"occurred_at":"2026-07-16T04:30:00.000Z","created_at":"2026-07-16T04:30:00.000Z"}],"meta":{"total":1,"page":1,"limit":20,"total_pages":1}}}}},"403":{"description":"Contexto Business o Workspace no autorizado."},"404":{"description":"Persona no encontrada."}}}},"/persons/{id}/organizations":{"get":{"summary":"Listar relaciones de una persona con organizaciones","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Relaciones activas de la persona.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonOrganizationRelationshipListSuccess"}}}}}},"post":{"summary":"Relacionar una persona con una organización","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonOrganizationRelationshipInput"}}}},"responses":{"201":{"description":"Relación creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonOrganizationRelationshipSuccess"}}}},"404":{"description":"Persona u organización no encontrada."}}}},"/persons/{id}/product-relationships":{"get":{"summary":"Listar relaciones de una persona con productos","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Relaciones con productos de Workspaces autorizados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartyProductRelationshipListSuccess"}}}}}},"post":{"summary":"Relacionar una persona con un producto","tags":["Persons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartyProductRelationshipInput"}}}},"responses":{"201":{"description":"Relación creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartyProductRelationshipSuccess"}}}},"403":{"description":"El usuario no puede administrar relaciones en el Workspace."},"404":{"description":"Persona o producto no encontrado."}}}},"/organizations":{"get":{"summary":"Listar organizaciones","tags":["Organizations"],"parameters":[{"in":"query","name":"q","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["active","inactive"]}},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Directorio paginado de organizaciones.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationListSuccess"}}}}}},"post":{"summary":"Crear organización","tags":["Organizations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreateInput"}}}},"responses":{"201":{"description":"Organización creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationSuccess"}}}},"409":{"description":"Nombre o identidad tributaria duplicada."}}}},"/organizations/{id}":{"get":{"summary":"Obtener organización por ID","tags":["Organizations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Organización encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationSuccess"}}}},"404":{"description":"Organización no encontrada."}}},"put":{"summary":"Actualizar organización","tags":["Organizations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationUpdateInput"}}}},"responses":{"200":{"description":"Organización actualizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationSuccess"}}}},"404":{"description":"Organización no encontrada."},"409":{"description":"Nombre o identidad tributaria duplicada."}}},"delete":{"summary":"Archivar organización","tags":["Organizations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Organización y sus relaciones archivadas."},"404":{"description":"Organización no encontrada."}}}},"/organizations/{id}/activity":{"get":{"summary":"Listar actividad transversal de una organización","tags":["Organizations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Timeline paginado de actividad autorizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactActivityListSuccess"}}}},"404":{"description":"Organización no encontrada."}}}},"/organizations/{id}/people":{"get":{"summary":"Listar relaciones de una organización con personas","tags":["Organizations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Relaciones activas de la organización.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonOrganizationRelationshipListSuccess"}}}}}}},"/organizations/{id}/product-relationships":{"get":{"summary":"Listar relaciones de una organización con productos","tags":["Organizations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Relaciones con productos de Workspaces autorizados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartyProductRelationshipListSuccess"}}}}}},"post":{"summary":"Relacionar una organización con un producto","tags":["Organizations"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartyProductRelationshipInput"}}}},"responses":{"201":{"description":"Relación creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartyProductRelationshipSuccess"}}}},"403":{"description":"El usuario no puede administrar relaciones en el Workspace."},"404":{"description":"Organización o producto no encontrado."}}}},"/directory-relationships/person-organizations/{relationshipId}":{"delete":{"summary":"Archivar una relación persona-organización","tags":["Directory Relationships"],"parameters":[{"in":"path","name":"relationshipId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Relación archivada."},"404":{"description":"Relación no encontrada."}}}},"/directory-relationships/party-products/{relationshipId}":{"delete":{"summary":"Archivar una relación con producto","tags":["Directory Relationships"],"parameters":[{"in":"path","name":"relationshipId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Relación archivada."},"403":{"description":"El producto pertenece a un Workspace no autorizado."},"404":{"description":"Relación no encontrada."}}}},"/persons/{id}/tags":{"get":{"summary":"Listar tags activos asignados a un contacto","tags":["Contact Tags"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/OptionalWorkspaceIdHeader"}],"responses":{"200":{"description":"Tags asignados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagCollectionSuccess"},"example":{"success":true,"data":[{"_id":"667200000f8a4f0012c3d222","business_id":"665a9f9f0f8a4f0012c3d456","name":"Cliente VIP","normalized_name":"cliente vip","color":"#7C3AED","created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-16T05:30:00.000Z","updated_at":"2026-07-16T05:30:00.000Z"}]}}}},"404":{"description":"Contacto no encontrado."}}},"put":{"summary":"Reemplazar tags de un contacto","tags":["Contact Tags"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/OptionalWorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagAssignmentInput"},"example":{"tag_ids":["667200000f8a4f0012c3d222"]}}}},"responses":{"200":{"description":"Asignacion reemplazada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagAssignmentSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z","contact_external_id":"665b1a3f0f8a4f0012c3d500","tag_ids":["667200000f8a4f0012c3d222"],"whatsapp":{"reachable":true,"has_phone":true,"username":"juanperez","country_code":"PE"}},"message":"Contact tags updated successfully"}}}},"400":{"description":"Uno o mas tags son invalidos."},"404":{"description":"Contacto no encontrado."}}}},"/persons/{id}/custom-fields":{"get":{"summary":"Listar custom fields asignados a un contacto","tags":["Contact Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/OptionalWorkspaceIdHeader"}],"responses":{"200":{"description":"Valores con sus definiciones activas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCustomFieldCollectionSuccess"},"example":{"success":true,"data":[{"definition":{"_id":"667300000f8a4f0012c3d333","business_id":"665a9f9f0f8a4f0012c3d456","name":"Fecha de alta","normalized_key":"fecha_de_alta","field_type":"date","position":0,"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-16T06:30:00.000Z","updated_at":"2026-07-16T06:30:00.000Z"},"value":"2026-07-16T00:00:00.000Z"}]}}}},"404":{"description":"Contacto no encontrado."}}},"put":{"summary":"Reemplazar custom fields de un contacto","tags":["Contact Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/OptionalWorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCustomFieldAssignmentInput"},"example":{"custom_fields":[{"field_id":"667300000f8a4f0012c3d333","value":"2026-07-16T00:00:00.000Z"}]}}}},"responses":{"200":{"description":"Valores reemplazados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCustomFieldAssignmentSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z","contact_external_id":"665b1a3f0f8a4f0012c3d500","tag_ids":["667200000f8a4f0012c3d222"],"whatsapp":{"reachable":true,"has_phone":true,"username":"juanperez","country_code":"PE"},"custom_fields":[{"field_id":"667300000f8a4f0012c3d333","value":"2026-07-16T00:00:00.000Z"}]},"message":"Contact custom fields updated successfully"}}}},"400":{"description":"Definicion o valor invalido."},"404":{"description":"Contacto no encontrado."}}}},"/contact-custom-fields":{"get":{"summary":"Listar definiciones de custom fields del Business","tags":["Contact Custom Fields"],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Definiciones paginadas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCustomFieldListSuccess"},"example":{"success":true,"data":[{"_id":"667300000f8a4f0012c3d333","business_id":"665a9f9f0f8a4f0012c3d456","name":"Fecha de alta","normalized_key":"fecha_de_alta","field_type":"date","position":0,"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-16T06:30:00.000Z","updated_at":"2026-07-16T06:30:00.000Z"}],"meta":{"total":1,"page":1,"limit":20,"total_pages":1}}}}}}},"post":{"summary":"Crear definicion de custom field","tags":["Contact Custom Fields"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCustomFieldCreateInput"},"example":{"name":"Fecha de alta","field_type":"date"}}}},"responses":{"201":{"description":"Definicion creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCustomFieldSuccess"},"example":{"success":true,"data":{"_id":"667300000f8a4f0012c3d333","business_id":"665a9f9f0f8a4f0012c3d456","name":"Fecha de alta","normalized_key":"fecha_de_alta","field_type":"date","position":0,"created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-16T06:30:00.000Z","updated_at":"2026-07-16T06:30:00.000Z"}}}}},"409":{"description":"La clave normalizada ya existe."}}}},"/contact-custom-fields/{id}":{"get":{"summary":"Obtener definicion de custom field","tags":["Contact Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Definicion encontrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCustomFieldSuccess"}}}},"404":{"description":"Definicion no encontrada."}}},"put":{"summary":"Actualizar nombre de custom field","tags":["Contact Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCustomFieldUpdateInput"},"example":{"name":"Fecha de registro"}}}},"responses":{"200":{"description":"Definicion actualizada."},"404":{"description":"Definicion no encontrada."},"409":{"description":"La clave normalizada ya existe."}}},"delete":{"summary":"Archivar definicion de custom field","tags":["Contact Custom Fields"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Definicion archivada."},"404":{"description":"Definicion no encontrada."},"409":{"description":"La definicion esta asignada a contactos."}}}},"/contact-tags":{"get":{"summary":"Listar tags del Business","tags":["Contact Tags"],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Tags paginados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagListSuccess"},"example":{"success":true,"data":[{"_id":"667200000f8a4f0012c3d222","business_id":"665a9f9f0f8a4f0012c3d456","name":"Cliente VIP","normalized_name":"cliente vip","color":"#7C3AED","created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-16T05:30:00.000Z","updated_at":"2026-07-16T05:30:00.000Z"}],"meta":{"total":1,"page":1,"limit":20,"total_pages":1}}}}}}},"post":{"summary":"Crear tag de contacto","tags":["Contact Tags"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagCreateInput"},"example":{"name":"Cliente VIP","color":"#7C3AED"}}}},"responses":{"201":{"description":"Tag creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagSuccess"},"example":{"success":true,"data":{"_id":"667200000f8a4f0012c3d222","business_id":"665a9f9f0f8a4f0012c3d456","name":"Cliente VIP","normalized_name":"cliente vip","color":"#7C3AED","created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-16T05:30:00.000Z","updated_at":"2026-07-16T05:30:00.000Z"},"message":"Contact tag created successfully"}}}},"409":{"description":"El nombre normalizado ya existe en el Business."}}}},"/contact-tags/{id}":{"get":{"summary":"Obtener tag de contacto","tags":["Contact Tags"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Tag obtenido.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagSuccess"},"example":{"success":true,"data":{"_id":"667200000f8a4f0012c3d222","business_id":"665a9f9f0f8a4f0012c3d456","name":"Cliente VIP","normalized_name":"cliente vip","color":"#7C3AED","created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-16T05:30:00.000Z","updated_at":"2026-07-16T05:30:00.000Z"}}}}},"404":{"description":"Tag no encontrado."}}},"put":{"summary":"Actualizar tag de contacto","tags":["Contact Tags"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagUpdateInput"},"example":{"name":"Cliente preferente","clear_color":true}}}},"responses":{"200":{"description":"Tag actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagSuccess"},"example":{"success":true,"data":{"_id":"667200000f8a4f0012c3d222","business_id":"665a9f9f0f8a4f0012c3d456","name":"Cliente VIP","normalized_name":"cliente vip","color":"#7C3AED","created_by":"665aa0040f8a4f0012c3d457","created_at":"2026-07-16T05:30:00.000Z","updated_at":"2026-07-16T05:30:00.000Z"},"message":"Contact tag updated successfully"}}}},"404":{"description":"Tag no encontrado."},"409":{"description":"El nombre normalizado ya existe en el Business."}}},"delete":{"summary":"Archivar tag de contacto","tags":["Contact Tags"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}},"409":{"description":"El tag esta asignado a uno o mas contactos."}}}},"/payment-coupons":{"get":{"summary":"Listar cupones","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"in":"query","name":"status","schema":{"type":"string","enum":["active","paid","voided"]}},{"in":"query","name":"search","schema":{"type":"string","minLength":1,"maxLength":160}},{"in":"query","name":"contact_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"receivable_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"settlement_id","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},{"in":"query","name":"external_ref","schema":{"type":"string","maxLength":160}},{"in":"query","name":"payment_coupon_code","schema":{"type":"string","maxLength":160}},{"in":"query","name":"start_date","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"end_date","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"date_field","schema":{"type":"string","enum":["created_at","issue_date","expiry_date","payment_date","paid_at"]}},{"in":"query","name":"sort_by","schema":{"type":"string","enum":["created_at","updated_at","issue_date","expiry_date","payment_date","paid_at","amount"]}},{"in":"query","name":"sort_order","schema":{"type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"Cupones paginados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponListSuccess"}}}}}},"post":{"summary":"Crear cupon","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponCreateInput"},"example":{"contact_id":"665b1a3f0f8a4f0012c3d500","amount":150.5,"external_ref":"ORD-9988","description":"Pago de membresia"}}}},"responses":{"201":{"description":"Cupón creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponSuccess"}}}}}}},"/payment-coupons/metrics":{"get":{"summary":"Obtener metricas de cupones","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Métricas de cupones.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponMetricsSuccess"}}}}}}},"/payment-coupons/contextual":{"post":{"operationId":"createContextualPaymentCoupon","summary":"Generar o reutilizar un cupón para un recurso del Workspace","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextualPaymentCouponCreateInput"}}}},"responses":{"201":{"description":"Cupón generado o reutilizado idempotentemente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponSuccess"}}}},"400":{"description":"El origen no tiene importe suficiente para generar el cobro."},"404":{"description":"El recurso origen no pertenece al Workspace."}}}},"/payment-coupons/template":{"get":{"summary":"Descargar plantilla de importacion","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Plantilla CSV UTF-8 con BOM.","headers":{"Content-Disposition":{"schema":{"type":"string"}}},"content":{"text/csv":{"schema":{"type":"string"}}}}}}},"/payment-coupons/import":{"post":{"summary":"Importar cupones desde JSON","description":"Acepta un array de filas o un objeto `{ coupons: [...] }`.","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponImportInput"}}}},"responses":{"200":{"description":"Resultado de la importación por filas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponImportSuccess"}}}}}}},"/payment-coupons/import/csv":{"post":{"summary":"Importar cupones desde CSV","description":"Acepta un archivo CSV UTF-8 mediante multipart/form-data.","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/PaymentCouponImportMultipartInput"}}}},"responses":{"200":{"description":"Resultado de la importación por filas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponImportSuccess"}}}}}}},"/payment-coupons/{id}":{"get":{"summary":"Obtener cupon por ID","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Cupón.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponSuccess"}}}}}},"put":{"summary":"Actualizar cupon por ID","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponUpdateInput"}}}},"responses":{"200":{"description":"Cupón actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponSuccess"}}}}}}},"/payment-coupons/{id}/annul":{"put":{"summary":"Anular cupon","tags":["PaymentCoupons"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Cupón anulado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponSuccess"}}}}}}},"/collections/policies":{"get":{"summary":"Listar políticas de cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Políticas de cobranza.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionPolicyListSuccess"}}}}}},"post":{"summary":"Crear política programática de cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionPolicyCreateInput"}}}},"responses":{"201":{"description":"Política creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionPolicySuccess"}}}}}}},"/collections/kanbans":{"get":{"operationId":"listCollectionKanbans","summary":"Listar Kanbans operativos de Cobranzas","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Kanbans de Cobranzas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionsKanbanListSuccess"}}}}}}},"/collections/cases":{"get":{"operationId":"listCollectionCases","summary":"Listar casos operativos de Cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"kanban_id","schema":{"type":"string"}},{"in":"query","name":"column_id","schema":{"type":"string"}},{"in":"query","name":"contact_id","schema":{"type":"string"}},{"in":"query","name":"responsible_user_id","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["open","closed"]}},{"in":"query","name":"classification","schema":{"type":"string","enum":["paid","uncollectible","referred","cancelled"]}},{"in":"query","name":"search","schema":{"type":"string"}}],"responses":{"200":{"description":"Casos de Cobranza.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseListSuccess"}}}}}},"post":{"operationId":"createCollectionCase","summary":"Crear un caso operativo de Cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseCreateInput"}}}},"responses":{"201":{"description":"Caso creado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseSuccess"}}}}}}},"/collections/cases/kanban":{"get":{"operationId":"getCollectionCaseBoard","summary":"Obtener cards de un Kanban de Cobranzas","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"kanban_id","required":true,"schema":{"type":"string"}},{"in":"query","name":"limit_per_column","schema":{"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"Kanban operativo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseBoardSuccess"}}}}}}},"/collections/cases/{id}":{"get":{"operationId":"getCollectionCase","summary":"Obtener detalle de un caso de Cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Caso de Cobranza.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseSuccess"}}}}}},"patch":{"operationId":"updateCollectionCase","summary":"Actualizar responsable o próxima acción","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseManagementInput"}}}},"responses":{"200":{"description":"Caso actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseSuccess"}}}}}}},"/collections/cases/{id}/transitions":{"get":{"operationId":"listCollectionCaseTransitions","summary":"Listar historial auditable de un caso de Cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Historial del caso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseTransitionListSuccess"}}}}}},"post":{"operationId":"transitionCollectionCase","summary":"Mover o cerrar un caso de Cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseTransitionInput"}}}},"responses":{"200":{"description":"Transición aplicada o reutilizada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseTransitionSuccess"}}}}}}},"/collections/cases/{id}/reopen":{"post":{"operationId":"reopenCollectionCase","summary":"Reabrir un caso de Cobranza cerrado","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseReopenInput"}}}},"responses":{"200":{"description":"Caso reabierto.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionCaseTransitionSuccess"}}}}}}},"/collections/dashboard":{"get":{"operationId":"getCollectionsDashboard","summary":"Obtener indicadores y analítica de Cobranza separados por moneda","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"from","required":true,"schema":{"type":"string","format":"date-time"}},{"in":"query","name":"to","required":true,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Indicadores del periodo y su comparación equivalente anterior.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionsDashboardSuccess"}}}}}}},"/collections/records":{"get":{"operationId":"listCollectionRecords","summary":"Listar cartera operativa enriquecida con Contactos","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["open","partially_paid","paid","voided"]}},{"in":"query","name":"currency","schema":{"type":"string","minLength":3,"maxLength":3}},{"in":"query","name":"aging","schema":{"type":"string","enum":["current","0_30","31_60","61_90","90_plus"]}},{"in":"query","name":"search","schema":{"type":"string"}}],"responses":{"200":{"description":"Registros de cartera paginados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionRecordListSuccess"}}}}}}},"/collections/receivables":{"get":{"summary":"Listar cartera de cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["open","partially_paid","paid","voided"]}},{"in":"query","name":"contact_id","schema":{"type":"string"}},{"in":"query","name":"search","schema":{"type":"string"}}],"responses":{"200":{"description":"Cartera.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionReceivableListSuccess"}}}}}},"post":{"summary":"Crear cuenta por cobrar","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionReceivableCreateInput"}}}},"responses":{"201":{"description":"Cuenta creada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionReceivableSuccess"}}}}}}},"/collections/receivables/{id}":{"get":{"summary":"Obtener cuenta por cobrar","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Cuenta por cobrar.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionReceivableSuccess"}}}}}}},"/collections/receivables/{id}/void":{"post":{"summary":"Anular cuenta por cobrar","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Cuenta anulada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionReceivableSuccess"}}}}}}},"/collections/receivables/{id}/attempts":{"get":{"summary":"Listar intentos de cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Intentos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionAttemptListSuccess"}}}}}},"post":{"summary":"Programar recordatorio WhatsApp con plantilla","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionAttemptCreateInput"}}}},"responses":{"201":{"description":"Intento programado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionAttemptSuccess"}}}}}}},"/collections/receivables/{id}/timeline":{"get":{"operationId":"getCollectionTimeline","summary":"Obtener la trazabilidad cronológica de una cuenta por cobrar","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Eventos financieros y operativos de la cobranza.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionTimelineSuccess"}}}}}}},"/collections/receivables/{id}/manual-payments":{"post":{"summary":"Registrar pago manual","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionManualPaymentInput"}}}},"responses":{"200":{"description":"Pago aplicado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionReceivableSuccess"}}}}}}},"/collections/receivables/{id}/promises":{"post":{"summary":"Registrar promesa de pago","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionPaymentPromiseInput"}}}},"responses":{"200":{"description":"Promesa registrada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionReceivableSuccess"}}}}}}},"/collections/receivables/{id}/disputes":{"post":{"summary":"Abrir disputa de cobranza","tags":["Collections"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionDisputeInput"}}}},"responses":{"200":{"description":"Disputa abierta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionReceivableSuccess"}}}}}}},"/settlements":{"get":{"summary":"Listar settlements","tags":["Settlements"],"responses":{"200":{"description":"Liquidaciones paginadas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettlementListSuccess"}}}}}}},"/settlements/metrics":{"get":{"summary":"Obtener metricas de settlements","tags":["Settlements"],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/settlements/{id}":{"get":{"summary":"Obtener settlement por ID","tags":["Settlements"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Liquidación.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettlementSuccess"}}}}}}},"/settlements/{id}/download":{"get":{"summary":"Descargar settlement por ID","tags":["Settlements"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/settlements/{id}/payment-coupons":{"get":{"summary":"Listar cupones de un settlement","tags":["Settlements"],"parameters":[{"$ref":"#/components/parameters/IdPathParam"}],"responses":{"200":{"description":"Cupones de la liquidación.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCouponListSuccess"}}}}}}},"/dashboard":{"get":{"summary":"Obtener resumen de dashboard","tags":["Dashboard"],"responses":{"200":{"description":"Resumen de pagos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentsDashboardSuccess"}}}}}}},"/users":{"post":{"summary":"Crear business admin","tags":["Users"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"email":"admin.negocio@empresa.com","name":"Admin Negocio","role":"admin"}}}},"responses":{"201":{"description":"Recurso creado correctamente.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"uid":"uid_360_admin_001","email":"admin.negocio@empresa.com","role":"admin","business_ids":["665a9f9f0f8a4f0012c3d456"]},"message":"Recurso creado correctamente"}}}}}}},"/users/active-business":{"put":{"summary":"Actualizar negocio activo del usuario","tags":["Users"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"note":"Revisa examples por endpoint para payload real."}}}},"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/hooks":{"get":{"summary":"Listar hooks del negocio","tags":["Webhooks"],"responses":{"200":{"description":"Hooks configurados.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessHookListSuccess"}}}}}},"post":{"summary":"Crear hook de negocio","tags":["Webhooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessHookCreateInput"},"example":{"type":"PAYMENT_PAID","url":"https://api.miapp.com/webhooks/360pay","active":true}}}},"responses":{"201":{"description":"Hook creado; signing_secret se muestra solo en esta respuesta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessHookSecretSuccess"}}}}}}},"/hooks/{hookId}":{"put":{"summary":"Actualizar hook","tags":["Webhooks"],"parameters":[{"$ref":"#/components/parameters/HookIdPathParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessHookUpdateInput"}}}},"responses":{"200":{"description":"Hook actualizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessHookSuccess"}}}}}},"delete":{"summary":"Eliminar hook","tags":["Webhooks"],"parameters":[{"$ref":"#/components/parameters/HookIdPathParam"}],"responses":{"200":{"description":"Operacion exitosa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccess"},"example":{"success":true,"data":{"_id":"665b1a3f0f8a4f0012c3d500","business_id":"665a9f9f0f8a4f0012c3d456","name":"Juan Perez","email":"juan@example.com","phone":"+51987654321","document_type":"DNI","document_number":"12345678","created_at":"2026-06-12T15:20:30.000Z","updated_at":"2026-06-12T15:20:30.000Z"},"message":"Operacion exitosa"}}}}}}},"/hooks/{hookId}/rotate-secret":{"post":{"summary":"Rotar secreto de hook","tags":["Webhooks"],"parameters":[{"$ref":"#/components/parameters/HookIdPathParam"}],"responses":{"200":{"description":"Secreto rotado; signing_secret se muestra solo en esta respuesta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessHookSecretSuccess"}}}}}}},"/hooks/{hookId}/test":{"post":{"summary":"Encolar una entrega sintética firmada","description":"No crea ni modifica cupones. Reutilizar Idempotency-Key devuelve la misma entrega.","tags":["Webhooks"],"parameters":[{"$ref":"#/components/parameters/HookIdPathParam"},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","maxLength":200}}],"responses":{"202":{"description":"Entrega sintética aceptada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliverySuccess"}}}}}}},"/hooks/{hookId}/deliveries":{"get":{"summary":"Listar entregas de un hook","tags":["Webhooks"],"parameters":[{"$ref":"#/components/parameters/HookIdPathParam"}],"responses":{"200":{"description":"Entregas paginadas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryListSuccess"}}}}}}},"/hooks/{hookId}/deliveries/{deliveryId}":{"get":{"summary":"Obtener detalle de entrega","tags":["Webhooks"],"parameters":[{"$ref":"#/components/parameters/HookIdPathParam"},{"$ref":"#/components/parameters/DeliveryIdPathParam"}],"responses":{"200":{"description":"Entrega.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliverySuccess"}}}}}}},"/hooks/{hookId}/deliveries/{deliveryId}/retry":{"post":{"summary":"Reintentar entrega de webhook","tags":["Webhooks"],"parameters":[{"$ref":"#/components/parameters/HookIdPathParam"},{"$ref":"#/components/parameters/DeliveryIdPathParam"}],"responses":{"200":{"description":"Entrega reenviada a la cola.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliverySuccess"}}}}}}}}}