{"openapi":"3.1.0","info":{"title":"Rules Manager Swagger","description":"\n## WorkFINITY® Solution Configuration Management System — Rules AI API\n\nAn enterprise-grade high-performance REST API for authoring, evaluating, testing, and managing business rules, decision logic, pricing formulas, reusable rule functions, and multi-modal AI agents over BPRM.\n\n---\n\n### 🔑 Authentication & Headers\nMost endpoints in this microservice require internal service authentication.\nClick the green **Authorize 🔓** button in Swagger UI and fill in **both** boxes, then **Authorize**:\n- **`APIKeyHeader (X-Internal-Auth)`**: your `<INTERNAL_SERVICE_SECRET>` (e.g., `wf_internal_...`)\n- **`AppId (X-App-Id)`**: the `Application.Id` GUID you work in (e.g., `a1b2c3d4-e5f6-7890-abcd-ef1234567890`)\n\nSwagger then sends both headers with every \"Try it out\" call, and keeps them across page reloads.\nEvery `/api` data endpoint is scoped to the `X-App-Id` application; requests without it get 400.\n\nPublic diagnostic endpoints (`/health` and `/db-ping`) do not require authentication.\n\n---\n\n### 🔎 Search, filters and paging\nEvery list endpoint takes the same query parameters:\n- **`search`**: case-insensitive text the name contains (`?search=loan`)\n- **`ruleType`**: Condition, Pricing, Calculation, Validation or Decision (`?ruleType=pricing`)\n- **`page`** and **`pageSize`**: 1-based paging; omit `pageSize` to get every row\n- List responses are `{items, total, page, pageSize}`.\n\nPickers use the short `GET …/lookup?search=` endpoints. Use the **Filter by tag** box above\nthe endpoint list to find an endpoint group.\n\n### ⚠️ Errors\nErrors are `{\"detail\": \"...\"}`: **400** missing X-App-Id or bad input, **401** wrong\nX-Internal-Auth or X-Delete-Auth, **404** not found in this application, **409** in use or\nchanged since read (RowVersion), **422** request body or parameter did not validate.\n\n### 🔁 Earlier paths and names\nEndpoints moved to resource-style URLs (`/rules/{id}/status`, `/rules/{id}/comments`,\n`PUT /rule-values`, `PATCH /rule-values/{version_id}`, `…/lookup`, `/rules-ai/script`). The\nearlier URLs and query names (`term`, `name_like`, `rule_name`, `rule_type`, `FunctionName`)\nstill work but are not listed here; see docs/CHANGELOG.md.\n\n---\n\n### 🧱 Hierarchy & Data Model\n- **`RuleDefinition`**: The core rule entity storing rule text (`RawRule`), condition scripts (`ScriptBody`), type, and approval status.\n- **`RuleDefinitionVersion`**: Immutable version history snapshots tracking rule modifications, approvals, publication, and retirement.\n- **`RuleFunction` & `RuleFunctionParameter`**: Reusable custom logic and mathematical functions available for expression binding.\n- **`RuleValueDefinition` & `RuleValueDefinitionVersion`**: Right-hand evaluation values and parameter matrices separated from rule definitions for flexible runtime adjustments.\n- **`Offer` & `PricingScriptBody`**: Partner and product offer structures linked to pricing and discount calculation rules.\n\n---\n\n### 🤖 AI Capabilities & Multi-Modal Agents\n- **AI Rule Compilation**: Transform plain-English prompts into structured Abstract Syntax Trees (`/api/rules-ai/compile`).\n- **Prompt-Driven Edits**: Manage rules, functions, versions, and publication using conversational instructions (`/api/rules-ai/edit-from-prompt`).\n- **AI Rule Agent**: Autonomous decision engine evaluating rules with context payloads and comprehensive decision analysis (`/api/ai/rule-agent/{rule_id}`).\n\n---\n\n### ⚡ Execution, Data Quality & Transfer\n- **Fast AST Evaluation**: Grouped conditions, logical operators (`AND`, `OR`), parentheses, and arithmetic execution (`/api/rules/{id}/evaluate`, `/api/rules/evaluate-batch`).\n- **Data Quality Scans**: Real-time detection of duplicate rule bodies, orphaned value versions, and overlapping condition ranges (`/api/data-quality`).\n- **Multi-Format Export**: Streamline audits and migration by exporting datasets to **CSV**, **JSON**, **Word (DOCX)**, or **PDF** (`/api/transfer/export`).\n","termsOfService":"https://workfinity.net/terms","contact":{"name":"WorkFINITY Support","url":"https://workfinity.net/","email":"support@workfinity.net"},"license":{"name":"Proprietary","url":"https://workfinity.net/"},"version":"1.9-debug"},"servers":[{"url":"/","description":"Current Server (Auto-detected)"},{"url":"http://localhost:8000","description":"Local Development (Port 8000)"},{"url":"http://localhost:5000","description":"Local Development (Port 5000)"},{"url":"https://rule-ai-portal.workfinity.com","description":"Production Portal"}],"paths":{"/health":{"get":{"tags":["Health"],"summary":"Service health and readiness check","description":"Returns service status, prompt template availability, OpenAI configuration, and current version.","operationId":"health_health_get","responses":{"200":{"description":"Service is healthy and ready to accept requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/db-ping":{"get":{"tags":["Health"],"summary":"Database connectivity ping test","description":"Executes a lightweight query against SQL Server to verify connectivity and driver readiness.","operationId":"db_ping_db_ping_get","responses":{"200":{"description":"Database connection healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DbPingResponse"}}}},"500":{"description":"Database connection failed or unreachable"}}}},"/api/stats":{"get":{"tags":["Utilities"],"summary":"Application operational runtime statistics","description":"Returns service name, current version, process uptime in seconds, and health status.","operationId":"api_stats_api_stats_get","responses":{"200":{"description":"Runtime operational metrics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppStatsResponse"}}}},"401":{"description":"Missing or invalid internal authorization header"}},"security":[{"APIKeyHeader":[]}]}},"/api/offer-rules":{"get":{"tags":["Rules"],"summary":"List offer rules (pricing rules)","description":"List offer rules of the X-App-Id application (plus shared rules).\n\nOffer rules are business rules stored in `dbo.RuleDefinition` with RuleType 'Pricing'\nthat govern commercial and partner offer calculations, rate adjustments, and fee matrices.","operationId":"list_offer_rules_direct_api_offer_rules_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact rule name.","title":"Name"},"description":"Exact rule name."},{"name":"approvedOnly","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by approved status: true / false.","title":"Approvedonly"},"description":"Filter by approved status: true / false."},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number, 1-based. Ignored without pageSize.","title":"Page"},"description":"Page number, 1-based. Ignored without pageSize."},{"name":"pageSize","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Rows per page. Omit to return every row on one page.","title":"Pagesize"},"description":"Rows per page. Omit to return every row on one page."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RulesListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/offer-rules/{id}":{"get":{"tags":["Rules"],"summary":"Get an offer rule","description":"One offer rule (RuleType 'Pricing') with its condition and pricing rows.","operationId":"get_offer_rule_direct_api_offer_rules__id__get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/offers/{offer_id}/rules":{"get":{"tags":["Rules"],"summary":"Get offer rules based on offer id (1 Offer : Many Rules)","description":"Retrieve all rules associated with a specific commercial offer from `dbo.OfferRule`.\n\nReturns rule definitions, conditions (`ScriptBody`), pricing formulas (`PricingScriptBody`),\nevaluation order number, and active status for the offer.","operationId":"get_offer_rules_api_offers__offer_id__rules_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"offer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Offer.Id","title":"Offer Id"},"description":"Offer.Id"},{"name":"ruleRole","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by rule role (e.g. Eligibility, Pricing, Validation)","title":"Rulerole"},"description":"Filter by rule role (e.g. Eligibility, Pricing, Validation)"},{"name":"enabledOnly","in":"query","required":false,"schema":{"type":"boolean","description":"Only return enabled rules for this offer","default":false,"title":"Enabledonly"},"description":"Only return enabled rules for this offer"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferRulesListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}},"post":{"tags":["Rules"],"summary":"Attach a rule to an offer","description":"Attach an existing business rule (`dbo.RuleDefinition`) to an offer with an evaluation order\nnumber and role (Eligibility, Pricing, Validation, etc.).","operationId":"attach_rule_to_offer_api_offers__offer_id__rules_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"offer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Offer.Id","title":"Offer Id"},"description":"Offer.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferRuleAttachIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferRuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/offers/{offer_id}/rules/{rule_id}":{"delete":{"tags":["Rules"],"summary":"Remove a rule from an offer","description":"Unlink a rule from an offer.","operationId":"remove_rule_from_offer_api_offers__offer_id__rules__rule_id__delete","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"offer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Offer.Id","title":"Offer Id"},"description":"Offer.Id"},{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id or OfferRule.Id","title":"Rule Id"},"description":"RuleDefinition.Id or OfferRule.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferRuleDeleteOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/offers/{offer_id}/rules/bulk":{"post":{"tags":["Rules"],"summary":"Bulk attach or update rules on an offer","description":"Attach multiple rules to an offer in one transaction.\nCan either replace all existing rules (replaceExisting=True) or upsert the given list.","operationId":"bulk_attach_rules_api_offers__offer_id__rules_bulk_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"offer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Offer.Id","title":"Offer Id"},"description":"Offer.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferRuleBulkIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferRuleBulkOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/offers/{offer_id}/rules/reorder":{"patch":{"tags":["Rules"],"summary":"Reorder evaluation priorities of rules in an offer","description":"Update sequence order numbers (OrderNumber) for a list of rules attached to this offer.","operationId":"reorder_rules_api_offers__offer_id__rules_reorder_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"offer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Offer.Id","title":"Offer Id"},"description":"Offer.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferRuleReorderIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferRuleReorderOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/offers/{offer_id}/evaluate":{"post":{"tags":["Rules"],"summary":"Evaluate all rules attached to an offer in sequence","description":"Runs all active rules attached to this commercial offer against customer context.\nEvaluates in configured OrderNumber sequence and returns aggregate eligibility decision.","operationId":"evaluate_offer_rules_in_order_api_offers__offer_id__evaluate_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"offer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Offer.Id","title":"Offer Id"},"description":"Offer.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferEvaluateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferEvaluateResponse"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/offers/{offer_id}/conflicts":{"get":{"tags":["Rules"],"summary":"Detect contradictory or redundant rules on an offer","description":"Analyzes all rules attached to this offer for pairwise condition contradictions\n(e.g. mutually exclusive thresholds where no customer can qualify).","operationId":"detect_offer_rule_conflicts_api_offers__offer_id__conflicts_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"offer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Offer.Id","title":"Offer Id"},"description":"Offer.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleConflictReportOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/partners/{partner_id}/rules":{"get":{"tags":["Rules"],"summary":"Get partner rules based on their offers","description":"Get all business rules associated with a partner across all of the partner's commercial offers.\n\nFlow: Partner -> Finds all partner offers (dbo.OfferPartner) -> Retrieves all attached rules (dbo.OfferRule).","operationId":"get_partner_rules_api_partners__partner_id__rules_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Partner.Id","title":"Partner Id"},"description":"Partner.Id"},{"name":"ruleRole","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by rule role (e.g. Eligibility, Pricing, Validation)","title":"Rulerole"},"description":"Filter by rule role (e.g. Eligibility, Pricing, Validation)"},{"name":"enabledOnly","in":"query","required":false,"schema":{"type":"boolean","description":"Only return enabled rules","default":false,"title":"Enabledonly"},"description":"Only return enabled rules"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerRulesOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/by-partner":{"get":{"tags":["Rules"],"summary":"Search partner rules by partner name or code","description":"Search partner rules:\nFirst searches for matching partners (e.g. 'ABC'), finds all offers for each partner,\nand returns all rules linked to those offers.","operationId":"search_partner_rules_api_rules_by_partner_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search term matching partner name or partner code (e.g. ABC)","title":"Search"},"description":"Search term matching partner name or partner code (e.g. ABC)"},{"name":"partnerCode","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by exact partner code","title":"Partnercode"},"description":"Filter by exact partner code"},{"name":"ruleRole","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by rule role (e.g. Eligibility, Pricing, Validation)","title":"Rulerole"},"description":"Filter by rule role (e.g. Eligibility, Pricing, Validation)"},{"name":"enabledOnly","in":"query","required":false,"schema":{"type":"boolean","description":"Only return enabled rules","default":false,"title":"Enabledonly"},"description":"Only return enabled rules"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerRulesSearchListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rules/execute-test":{"post":{"tags":["Rule Testing"],"summary":"Execute rule condition test against mock data","description":"Run a rule's text (`prompt`) against mock data (`test_data`) without saving anything: the\nbuilder's Validate Script. success is false while the text still has unfilled placeholders.","operationId":"execute_test_rule_api_rules_execute_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleTestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleTestResponse"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[],"AppId":[]}]}},"/api/rules/cache/stats":{"get":{"tags":["Rules","Utilities"],"summary":"Get rule compiler cache metrics","description":"Retrieve runtime caching metrics for compiled AST trees and published rules.","operationId":"get_rule_cache_statistics_api_rules_cache_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleCacheStatsOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}},"security":[{"APIKeyHeader":[],"AppId":[]}]}},"/api/rules/cache/clear":{"post":{"tags":["Rules","Utilities"],"summary":"Clear rule compiler and AST caches","description":"Flushes compiled ASTs and cached published rule scripts.","operationId":"clear_rule_caches_api_rules_cache_clear_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Optional rule ID to invalidate","title":"Rule Id"},"description":"Optional rule ID to invalidate"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleCacheClearOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rules":{"get":{"tags":["Rules"],"summary":"List rules","description":"Rules of the X-App-Id application (plus shared rules), newest first. A partner's user\nsees only its partner's rules; with `catalog=true`, your approved rules to copy.\n\nFilters combine: `search` matches part of the name, `name` the whole name.\nEach row carries **Version**, the rule's highest RuleDefinitionVersion number, and\n**ValuesVersion**, its live value version (null while only base values exist).","operationId":"list_rules_api_rules_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."},{"name":"ruleType","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Condition, Pricing, Calculation, Validation or Decision, in any case or as a prefix ('calc'). See GET /api/rules/types.","examples":["Pricing"],"title":"Ruletype"},"description":"Condition, Pricing, Calculation, Validation or Decision, in any case or as a prefix ('calc'). See GET /api/rules/types."},{"name":"id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Only the rule with this RuleDefinition.Id.","title":"Id"},"description":"Only the rule with this RuleDefinition.Id."},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact rule name.","title":"Name"},"description":"Exact rule name."},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number, 1-based. Ignored without pageSize.","title":"Page"},"description":"Page number, 1-based. Ignored without pageSize."},{"name":"pageSize","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Rows per page. Omit to return every row on one page.","title":"Pagesize"},"description":"Rows per page. Omit to return every row on one page."},{"name":"catalog","in":"query","required":false,"schema":{"type":"boolean","description":"Your approved rules a partner may copy (for the partner workspace).","default":false,"title":"Catalog"},"description":"Your approved rules a partner may copy (for the partner workspace)."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"draft (not approved), mine (checked out to you), approved, values_unset (approved, no values set yet), or inactive (deactivated with Status 0).","title":"Status"},"description":"draft (not approved), mine (checked out to you), approved, values_unset (approved, no values set yet), or inactive (deactivated with Status 0)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RulesListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Rules"],"summary":"Create a rule","description":"Create a rule in the X-App-Id application. Send `ExistingRuleID` to start from a copy\nof another rule. The rule starts unapproved, as Draft version 1 checked out to its creator.","operationId":"create_rule_api_rules_post","security":[{"APIKeyHeader":[],"AppId":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleCreate"},"examples":{"condition":{"summary":"Condition rule","value":{"Name":"Adult applicant","Type":"Condition","Description":"Applicant must be over 18","Body":"If(Applicant.age > 18) { Loan.status = \"approve\" }EndIf","ScriptBody":[{"Data_Type":"Applicant","Attribute_Name":"age","Operator":">","Value_Type":"Value","Value":18,"Connecter":""}]}},"pricing":{"summary":"Pricing (offer) rule","value":{"Name":"Large loan discount","Type":"Pricing","Body":"If(Loan.amount >= 500000) { Loan.rate = Loan.rate - 0.25 }EndIf","PricingScriptBody":[{"Data_Type":"Loan","Attribute_Name":"rate","Operator":"=","Value_Type":"Expression","Expression":"Loan.rate - 0.25"}]},"description":"Offer rules are stored with RuleType Pricing."},"clone":{"summary":"Copy an existing rule","value":{"ExistingRuleID":"3fa85f64-5717-4562-b3fc-2c963f66afa6","Name":"Adult applicant (copy)"},"description":"Starts the new rule from ExistingRuleID; fields you send override the copy."}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rules/types":{"get":{"tags":["Rules"],"summary":"List rule types","description":"The rule types RuleDefinition.RuleType allows, as {code, name}. Offer rules are\nstored as Pricing.","operationId":"list_types_api_rules_types_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleTypesOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}},"security":[{"APIKeyHeader":[],"AppId":[]}]}},"/api/rules/lookup":{"get":{"tags":["Rules"],"summary":"Look up rules by name (pickers)","description":"Id, name, type and flags of matching rules, by name. Without `search`, the first 20.","operationId":"search_rules_minimal_api_rules_lookup_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RuleLookupItem"},"title":"Response Search Rules Minimal Api Rules Lookup Get"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rules/offers":{"get":{"tags":["Rules"],"summary":"List offer rules (pricing rules)","description":"List offer rules of the X-App-Id application (plus shared rules).\n\nOffer rules are business rules stored in `dbo.RuleDefinition` with RuleType 'Pricing'\nthat govern commercial and partner offer calculations, rate adjustments, and fee matrices.","operationId":"list_offer_rules_api_rules_offers_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact rule name.","title":"Name"},"description":"Exact rule name."},{"name":"approvedOnly","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by approved status: true / false.","title":"Approvedonly"},"description":"Filter by approved status: true / false."},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number, 1-based. Ignored without pageSize.","title":"Page"},"description":"Page number, 1-based. Ignored without pageSize."},{"name":"pageSize","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Rows per page. Omit to return every row on one page.","title":"Pagesize"},"description":"Rows per page. Omit to return every row on one page."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RulesListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rules/offers/{id}":{"get":{"tags":["Rules"],"summary":"Get an offer rule","description":"One offer rule (RuleType 'Pricing') with its condition and pricing rows.","operationId":"get_offer_rule_api_rules_offers__id__get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}":{"get":{"tags":["Rules"],"summary":"Get a rule","description":"One rule with its condition and pricing rows and its latest version number.","operationId":"get_rule_api_rules__id__get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}},"patch":{"tags":["Rules"],"summary":"Update a rule","description":"Change only the fields you send. Send `RowVersion` to be refused (409) if the rule changed since\nyou read it. Changing the rule's logic (Body, AiRuleExpression, ScriptBody, PricingScriptBody)\nneeds your check-out (409 NOT_CHECKED_OUT / CHECKED_OUT otherwise).","operationId":"update_rule_api_rules__id__patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleUpdate"},"examples":{"text":{"summary":"Change the rule text","value":{"Body":"If(Applicant.age >= 21) { Loan.status = \"approve\" }EndIf"}},"describe":{"summary":"Rename and describe","value":{"Name":"Adult applicant (21+)","Description":"Raised to 21"}},"guarded":{"summary":"Edit only if unchanged since read","value":{"Description":"Reviewed","RowVersion":"0x00000000000007D3"},"description":"Send the RowVersion you read; 409 if someone changed the rule since."}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}},"delete":{"tags":["Rules"],"summary":"Delete a rule","description":"Delete an unapproved rule that nothing uses. Send the deletion code in the X-Delete-Auth header.","operationId":"delete_rule_api_rules__id__delete","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"auth","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Deprecated: send X-Delete-Auth instead; query strings end up in server and proxy logs.","title":"Auth"},"description":"Deprecated: send X-Delete-Auth instead; query strings end up in server and proxy logs.","deprecated":true},{"name":"X-Delete-Auth","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Deletion auth code from environment","title":"X-Delete-Auth"},"description":"Deletion auth code from environment"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"403":{"description":"The rule is approved."},"409":{"description":"Refused: a checklist step, route or form uses it, or the database keeps it."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/compose":{"get":{"tags":["Rules"],"summary":"Get a rule's composed condition and pricing view","description":"The rule text, its condition rows and its pricing rows, numbered from 1.","operationId":"get_compose_api_rules__id__compose_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleComposeGetOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}},"patch":{"tags":["Rules"],"summary":"Update a rule's condition script and pricing rows","description":"`script` updates the rule text and condition rows (ScriptBody); `pricing` appends\naction rows to PricingScriptBody, or replaces them with `replace_pricing`. Send\n`RowVersion` to be refused (409) if the rule changed since you read it.","operationId":"patch_compose_api_rules__id__compose_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleComposeIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleComposeResult"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/import":{"post":{"tags":["Rules"],"summary":"Import rules from a file","description":"Create rules in the X-App-Id application from a CSV or JSON file. Columns: RuleName and\nRuleType (Condition, Pricing, Calculation, Validation, Decision) are required; AppliesTo,\nWhen, Then and Else give the rule in plain words, kept in AiRuleExpression for the rule\ndesigner and AI rule agent; Body may hold the formal rule text. Each rule starts\nunapproved, as Draft version 1. A name the application already has is skipped; each failed\nrow is reported with its row number. Use dryRun=true to validate only.","operationId":"import_rules_file_api_rules_import_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"dryRun","in":"query","required":false,"schema":{"type":"boolean","description":"Validate and report without saving","default":false,"title":"Dryrun"},"description":"Validate and report without saving"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ImportFileForm"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportResult"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rules/{id}/test-cases":{"get":{"tags":["Rules"],"summary":"List a rule's saved test cases","description":"Named test data kept with the rule; the builder runs them all (POST /rules/execute-test) before a check-in.","operationId":"list_test_cases_api_rules__id__test_cases_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedTestCasesOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}},"put":{"tags":["Rules"],"summary":"Replace a rule's saved test cases","description":"Replaces all of the rule's test cases with `items` (in that order). Names are unique per rule,\nignoring case. `ExpectApplies` says whether the rule should apply to the data (null: only run it).","operationId":"replace_test_cases_api_rules__id__test_cases_put","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedTestCasesIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedTestCasesOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/checkout":{"post":{"tags":["Rules"],"summary":"Check out a rule to change it","description":"Locks the rule for you. A Published rule (or one with no versions) gets the next Draft\nversion, a snapshot of the rule; a Draft nobody holds is claimed. 409 CHECKED_OUT when\nsomeone else holds it. The lock lapses after RULE_CHECKOUT_HOURS.","operationId":"check_out_rule_api_rules__id__checkout_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CheckRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/checkin":{"post":{"tags":["Rules"],"summary":"Check in and publish the rule","description":"Copies the rule into your Draft, releases the lock and publishes it (the previously published\nversion is retired, unless a workflow still uses it). Already checked in -> the rule, unchanged.","operationId":"check_in_rule_api_rules__id__checkin_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CheckRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/draft":{"delete":{"tags":["Rules"],"summary":"Discard the rule's draft version","description":"Deletes the Draft and restores the rule from its published version. 409 when someone else holds it.","operationId":"discard_rule_draft_api_rules__id__draft_delete","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/approve":{"patch":{"tags":["Rules"],"summary":"Approve a rule and publish a version","description":"Approve a rule and publish the next RuleDefinitionVersion snapshot of it.","operationId":"approve_rule_api_rules__id__approve_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleApproveOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/status":{"patch":{"tags":["Rules"],"summary":"Toggle a rule's approval","description":"Flip approval. Approving publishes the next version; unapproving retires the\npublished version, refused while a workflow uses it.","operationId":"status_change_api_rules__id__status_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"current_status","in":"query","required":true,"schema":{"type":"integer","description":"The rule's approval now: 1 unapproves it, 0 approves it.","title":"Current Status"},"description":"The rule's approval now: 1 unapproves it, 0 approves it."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusChangeOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"409":{"description":"Refused: a checklist step, route or form uses it, or the database keeps it."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/comments":{"post":{"tags":["Rules"],"summary":"Comment on a rule","description":"Store the comment as the rule's UpdatedNotes (StatusDescription).","operationId":"create_comment_api_rules__id__comments_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentIn"},"examples":{"comment":{"summary":"Comment","value":{"text":"Reviewed with credit team"}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/enabled":{"patch":{"tags":["Rules"],"summary":"Enable or disable a rule","description":"Enable or disable a rule (RuleDefinition.IsEnabled) without touching its approval.","operationId":"set_rule_enabled_api_rules__id__enabled_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"enabled","in":"query","required":true,"schema":{"type":"boolean","description":"true to enable the rule, false to disable it","title":"Enabled"},"description":"true to enable the rule, false to disable it"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/usage":{"get":{"tags":["Rules"],"summary":"Where a rule is used","description":"Where the rule is used: checklist steps (ItemRuleDefinition), routes\n(ChecklistItemRoute), forms (ItemFormDefinition) and the number of workflow runs\n(WorkItemRule), each with the rule version it pins.","operationId":"get_rule_usage_api_rules__id__usage_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"versionId","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Only this RuleDefinitionVersion.","title":"Versionid"},"description":"Only this RuleDefinitionVersion."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleUsageOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/dependencies":{"get":{"tags":["Rules"],"summary":"Rule usage and dependency graph","description":"Returns the complete dependency graph for a business rule:\n- Associated commercial offers (and their active status / order number)\n- Associated business partners (via commercial offers)\n- Total version and dynamic value version counts\n- Safety check (`canSafelyDeleteOrArchive`) and blocking reasons","operationId":"get_rule_dependencies_api_rules__id__dependencies_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleDependenciesOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/explain":{"get":{"tags":["Rules"],"summary":"Plain-English rule explanation","description":"Synthesizes a plain-English narrative explanation of this rule's conditions,\ncomparison operators, thresholds, and execution adjustments.","operationId":"explain_rule_endpoint_api_rules__id__explain_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleExplainOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/generate-test-cases":{"post":{"tags":["Rules"],"summary":"Auto-generate test cases for a rule","description":"Synthesizes realistic evaluation payloads (passing scenario, failing boundary scenario,\nand edge cases) tailored to the rule's data types and attributes.","operationId":"generate_rule_test_cases_api_rules__id__generate_test_cases_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleTestCasesOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/versions":{"get":{"tags":["Rules"],"summary":"List a rule's versions","description":"The rule's RuleDefinitionVersion snapshots, newest first.","operationId":"list_rule_versions_api_rules__id__versions_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number, 1-based. Ignored without pageSize.","title":"Page"},"description":"Page number, 1-based. Ignored without pageSize."},{"name":"pageSize","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Rows per page. Omit to return every row on one page.","title":"Pagesize"},"description":"Rows per page. Omit to return every row on one page."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleVersionsListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}},"post":{"tags":["Rules"],"summary":"Save a draft version","description":"Save the rule as it is now as the next Draft version.","operationId":"create_draft_version_api_rules__id__versions_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleDraftVersionIn"},"examples":{"notes":{"summary":"Draft with notes","value":{"Notes":"Before raising the age limit"}},"empty":{"summary":"Draft without notes","value":{}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleVersionItem"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/diff":{"get":{"tags":["Rules"],"summary":"Compare two rule versions","description":"Side-by-side comparison between two rule versions.\nReturns unified text diff, condition modifications (old vs new threshold values), and pricing formula diffs.","operationId":"compare_rule_versions_api_rules__id__diff_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"v1","in":"query","required":true,"schema":{"type":"integer","description":"First version number to compare","title":"V1"},"description":"First version number to compare"},{"name":"v2","in":"query","required":true,"schema":{"type":"integer","description":"Second version number to compare","title":"V2"},"description":"Second version number to compare"},{"name":"target","in":"query","required":false,"schema":{"type":"string","description":"Compare 'definition' (logic script) or 'values' (dynamic threshold values)","default":"definition","title":"Target"},"description":"Compare 'definition' (logic script) or 'values' (dynamic threshold values)"},{"name":"ruleVersion","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"For values: the rule version whose value versions v1 and v2 are (default: the live one).","title":"Ruleversion"},"description":"For values: the rule version whose value versions v1 and v2 are (default: the live one)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleVersionDiffOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/rollback/{version}":{"post":{"tags":["Rules"],"summary":"Rollback rule to a previous version","description":"Restores an older approved rule version or value version.","operationId":"rollback_rule_api_rules__id__rollback__version__post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"version","in":"path","required":true,"schema":{"type":"integer","description":"Version number to restore","title":"Version"},"description":"Version number to restore"},{"name":"target","in":"query","required":false,"schema":{"type":"string","description":"Rollback 'definition' or 'values'","default":"definition","title":"Target"},"description":"Rollback 'definition' or 'values'"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleRollbackOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/versions/{version_id}/publish":{"patch":{"tags":["Rules"],"summary":"Publish a version","description":"Publish a Draft version, or restore a Retired one. The previously published version\nis retired, so a rule has one published version at a time.","operationId":"publish_rule_version_api_rules__id__versions__version_id__publish_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinitionVersion.Id","title":"Version Id"},"description":"RuleDefinitionVersion.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleVersionItem"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/versions/{version_id}/retire":{"patch":{"tags":["Rules"],"summary":"Retire a published version","description":"Retire a published version. Refused while a checklist step, route or form uses it.","operationId":"retire_rule_version_api_rules__id__versions__version_id__retire_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinitionVersion.Id","title":"Version Id"},"description":"RuleDefinitionVersion.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleVersionItem"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"409":{"description":"Refused: a checklist step, route or form uses it, or the database keeps it."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/{id}/versions/{version_id}":{"delete":{"tags":["Rules"],"summary":"Delete a draft version","description":"Delete a Draft version. Published and Retired versions are kept by the database.","operationId":"delete_rule_version_api_rules__id__versions__version_id__delete","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Id"},"description":"RuleDefinition.Id"},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinitionVersion.Id","title":"Version Id"},"description":"RuleDefinitionVersion.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"409":{"description":"Refused: a checklist step, route or form uses it, or the database keeps it."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-functions":{"get":{"tags":["Rule Functions"],"summary":"List rule functions","description":"Rule functions (dbo.RuleFunction, with their RuleFunctionParameter rows) of the\nX-App-Id application plus shared functions, newest first.","operationId":"list_functions_api_rule_functions_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact function name.","title":"Name"},"description":"Exact function name."},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number, 1-based. Ignored without pageSize.","title":"Page"},"description":"Page number, 1-based. Ignored without pageSize."},{"name":"pageSize","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Rows per page. Omit to return every row on one page.","title":"Pagesize"},"description":"Rows per page. Omit to return every row on one page."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FunctionsListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Rule Functions"],"summary":"Create a rule function","description":"Create a rule function (RuleFunction) and its parameters. FunctionKey is derived from\nFunctionName when omitted; ReturnType defaults to Any.","operationId":"create_function_api_rule_functions_post","security":[{"APIKeyHeader":[],"AppId":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FunctionCreate"},"examples":{"function":{"summary":"Function with parameters","value":{"Name":"Age From Date","ReturnType":"Number","Description":"Whole years between a date and today","SampleText":"AgeFromDate(Applicant.dob)","Parameters":[{"ParameterName":"date","ParameterType":"Date","IsRequired":true}]}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FunctionOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-functions/lookup":{"get":{"tags":["Rule Functions"],"summary":"Look up functions by name (autocomplete)","description":"Id, name, key and approval of functions whose name or key contains `search`. Without it, the first 20.","operationId":"search_function_minimal_api_rule_functions_lookup_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FunctionLookupItem"},"title":"Response Search Function Minimal Api Rule Functions Lookup Get"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-functions/{id}":{"get":{"tags":["Rule Functions"],"summary":"Get a rule function","description":"One rule function with its parameter definitions.","operationId":"get_function_api_rule_functions__id__get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleFunction.Id","title":"Id"},"description":"RuleFunction.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FunctionOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}},"patch":{"tags":["Rule Functions"],"summary":"Update a rule function","description":"Change only the fields you send. `params`, when sent, replaces every parameter row.","operationId":"update_function_api_rule_functions__id__patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleFunction.Id","title":"Id"},"description":"RuleFunction.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FunctionUpdate"},"examples":{"describe":{"summary":"Change the description","value":{"Description":"Whole years, rounded down"}},"params":{"summary":"Replace the parameters","value":{"Parameters":[{"ParameterName":"date","ParameterType":"Date","IsRequired":true},{"ParameterName":"asOf","ParameterType":"Date","IsRequired":false}]},"description":"Parameters replaces every parameter row of the function."}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FunctionOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}},"delete":{"tags":["Rule Functions"],"summary":"Delete a rule function","description":"Delete a function that is neither approved (IsActive) nor configured (IsImplemented).\nSend the deletion code in the X-Delete-Auth header.","operationId":"delete_function_api_rule_functions__id__delete","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleFunction.Id","title":"Id"},"description":"RuleFunction.Id"},{"name":"auth","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Deprecated: send X-Delete-Auth instead; query strings end up in server and proxy logs.","title":"Auth"},"description":"Deprecated: send X-Delete-Auth instead; query strings end up in server and proxy logs.","deprecated":true},{"name":"X-Delete-Auth","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Deletion auth code from environment","title":"X-Delete-Auth"},"description":"Deletion auth code from environment"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"403":{"description":"The function is approved or configured."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-functions/{id}/status":{"patch":{"tags":["Rule Functions"],"summary":"Toggle a function's approval","description":"Flip Approved (RuleFunction.IsActive).","operationId":"status_change_function_api_rule_functions__id__status_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleFunction.Id","title":"Id"},"description":"RuleFunction.Id"},{"name":"current_status","in":"query","required":true,"schema":{"type":"integer","description":"The function's approval now: 1 unapproves it, 0 approves it.","title":"Current Status"},"description":"The function's approval now: 1 unapproves it, 0 approves it."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusChangeOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values":{"get":{"tags":["Rule Values"],"summary":"List rules with their latest values","description":"Each rule with its latest values (RuleValueDefinitionVersion), listing rules that\nhave values and approved rules that do not yet. raw_rule is the rule text,\nrule_with_value its values, pricing_with_value its pricing values; LiveVersion is the\nhighest published value version (Version may be a newer draft).","operationId":"list_object_versions_api_rule_values_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."},{"name":"ruleType","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Condition, Pricing, Calculation, Validation or Decision, in any case or as a prefix ('calc'). See GET /api/rules/types.","examples":["Pricing"],"title":"Ruletype"},"description":"Condition, Pricing, Calculation, Validation or Decision, in any case or as a prefix ('calc'). See GET /api/rules/types."},{"name":"ruleName","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact rule name.","title":"Rulename"},"description":"Exact rule name."},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number, 1-based. Ignored without pageSize.","title":"Page"},"description":"Page number, 1-based. Ignored without pageSize."},{"name":"pageSize","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Rows per page. Omit to return every row on one page.","title":"Pagesize"},"description":"Rows per page. Omit to return every row on one page."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"mine (values checked out to you), unset (no values set yet) or checked_in.","title":"Status"},"description":"mine (values checked out to you), unset (no values set yet) or checked_in."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValuesListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Rule Values"],"summary":"Set a rule's values (adds a value version)","description":"Store ScriptBody (or Data) as the rule's values (RuleValueDefinition.ScriptBody) and add the next\nRuleValueDefinitionVersion. The rule's pricing values are carried over unchanged.","operationId":"create_new_version_api_rule_values_put","security":[{"APIKeyHeader":[],"AppId":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueModifyIn"},"examples":{"values":{"summary":"New value version","value":{"RuleDefinitionId":"3fa85f64-5717-4562-b3fc-2c963f66afa6","ScriptBody":"age > 21","Description":"Raised limit"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-values/lookup":{"get":{"tags":["Rule Values"],"summary":"Look up value versions by rule name (pickers)","description":"Value versions with their rule's name, newest first. Without `search`, the latest 20.","operationId":"lookup_rule_values_api_rule_values_lookup_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ValueVersionLookupItem"},"title":"Response Lookup Rule Values Api Rule Values Lookup Get"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-values/rule/{rule_id}":{"get":{"tags":["Rule Values"],"summary":"List a rule's value versions","description":"Every value version of one rule, newest first.","operationId":"list_versions_for_rule_api_rule_values_rule__rule_id__get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Rule Id"},"description":"RuleDefinition.Id"},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number, 1-based. Ignored without pageSize.","title":"Page"},"description":"Page number, 1-based. Ignored without pageSize."},{"name":"pageSize","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Rows per page. Omit to return every row on one page.","title":"Pagesize"},"description":"Rows per page. Omit to return every row on one page."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValuesListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/{version_id}":{"patch":{"tags":["Rule Values"],"summary":"Correct one value version","description":"Edit a value version in place (ScriptBody/Data, Description/Remarks) without adding a version. Optional\nRuleDefinitionId (or Rule_Id) guards that the version belongs to that rule.","operationId":"edit_object_version_row_api_rule_values__version_id__patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleValueDefinitionVersion.Id","title":"Version Id"},"description":"RuleValueDefinitionVersion.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueEditIn"},"examples":{"data":{"summary":"Correct the data","value":{"ScriptBody":"age > 21"}},"guarded":{"summary":"Correct, checking the rule","value":{"ScriptBody":"age > 21","RuleDefinitionId":"3fa85f64-5717-4562-b3fc-2c963f66afa6"},"description":"404 unless the version belongs to RuleDefinitionId."}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/rule/{rule_id}/checkout":{"post":{"tags":["Rule Values"],"summary":"Check out a rule's values","description":"Locks the rule's values for you in an unpublished value version (a copy of the current values,\nor one nobody holds). Value changes go into it. 409 CHECKED_OUT when someone else holds it.","operationId":"check_out_rule_values_api_rule_values_rule__rule_id__checkout_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Rule Id"},"description":"RuleDefinition.Id"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CheckRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/rule/{rule_id}/checkin":{"post":{"tags":["Rule Values"],"summary":"Check in and publish a rule's values","description":"Publishes your checked-out value version and releases the lock.","operationId":"check_in_rule_values_api_rule_values_rule__rule_id__checkin_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Rule Id"},"description":"RuleDefinition.Id"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CheckRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/rule/{rule_id}/draft":{"delete":{"tags":["Rule Values"],"summary":"Discard a rule's unpublished values","description":"Deletes the unpublished value version and goes back to the previous values.","operationId":"discard_rule_values_api_rule_values_rule__rule_id__draft_delete","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Rule Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/offers":{"put":{"tags":["Rule Values"],"summary":"Set an approved rule's pricing values (adds a value version)","description":"Store PricingScriptBody (or Data) as the rule's pricing values (RuleValueDefinition.PricingScriptBody) and add\nthe next RuleValueDefinitionVersion. The rule must be approved (400 otherwise).","operationId":"edit_rule_version_offers_api_rule_values_offers_put","security":[{"APIKeyHeader":[],"AppId":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueModifyIn"},"examples":{"pricing":{"summary":"New pricing value version","value":{"RuleDefinitionId":"3fa85f64-5717-4562-b3fc-2c963f66afa6","PricingScriptBody":"Loan.rate = Loan.rate - 0.25","Description":"Festive offer"},"description":"The rule must be approved."}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Rule Values"],"summary":"List approved rules with their latest values","description":"Every approved rule with its latest value version, for the offer screen.","operationId":"get_object_rules_version_by_offer_api_rule_values_offers_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."},{"name":"ruleType","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Condition, Pricing, Calculation, Validation or Decision, in any case or as a prefix ('calc'). See GET /api/rules/types.","examples":["Pricing"],"title":"Ruletype"},"description":"Condition, Pricing, Calculation, Validation or Decision, in any case or as a prefix ('calc'). See GET /api/rules/types."},{"name":"ruleName","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact rule name.","title":"Rulename"},"description":"Exact rule name."},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number, 1-based. Ignored without pageSize.","title":"Page"},"description":"Page number, 1-based. Ignored without pageSize."},{"name":"pageSize","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Rows per page. Omit to return every row on one page.","title":"Pagesize"},"description":"Rows per page. Omit to return every row on one page."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValuesListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-values/offers/{version_id}":{"patch":{"tags":["Rule Values"],"summary":"Correct the pricing values of one value version","description":"Edit the pricing values (PricingScriptBody/Data, Description/Remarks) of a value version in place, without adding a version.","operationId":"edit_object_rule_version_offer_row_api_rule_values_offers__version_id__patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleValueDefinitionVersion.Id","title":"Version Id"},"description":"RuleValueDefinitionVersion.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueEditIn"},"examples":{"data":{"summary":"Correct the data","value":{"ScriptBody":"age > 21"}},"guarded":{"summary":"Correct, checking the rule","value":{"ScriptBody":"age > 21","RuleDefinitionId":"3fa85f64-5717-4562-b3fc-2c963f66afa6"},"description":"404 unless the version belongs to RuleDefinitionId."}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/offers/{version_id}/toggle-approved":{"patch":{"tags":["Rule Values"],"summary":"Publish / unpublish one value version","description":"Toggle IsPublished on one RuleValueDefinitionVersion.","operationId":"toggle_offer_rule_version_approved_api_rule_values_offers__version_id__toggle_approved_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleValueDefinitionVersion.Id","title":"Version Id"},"description":"RuleValueDefinitionVersion.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferToggleOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/offers/rule/{rule_id}/checkout":{"post":{"tags":["Rule Values"],"summary":"Check out a rule's values","description":"Locks the rule's values for you in an unpublished value version (a copy of the current values,\nor one nobody holds). Value changes go into it. 409 CHECKED_OUT when someone else holds it.","operationId":"check_out_rule_values_api_rule_values_offers_rule__rule_id__checkout_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Rule Id"},"description":"RuleDefinition.Id"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CheckRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/offers/rule/{rule_id}/checkin":{"post":{"tags":["Rule Values"],"summary":"Check in and publish a rule's values","description":"Publishes your checked-out value version and releases the lock.","operationId":"check_in_rule_values_api_rule_values_offers_rule__rule_id__checkin_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Rule Id"},"description":"RuleDefinition.Id"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CheckRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/offers/rule/{rule_id}/draft":{"delete":{"tags":["Rule Values"],"summary":"Discard a rule's unpublished values","description":"Deletes the unpublished value version and goes back to the previous values.","operationId":"discard_rule_values_api_rule_values_offers_rule__rule_id__draft_delete","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Rule Id"},"description":"RuleDefinition.Id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValueRowOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/publish":{"get":{"tags":["Rule Values"],"summary":"List value versions for publishing","description":"Every value version (RuleValueDefinitionVersion) for the Publish screen, newest\nfirst. Approved is the version's IsPublished (1 / 0).","operationId":"list_publish_object_versions_api_rule_values_publish_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."},{"name":"ruleType","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Condition, Pricing, Calculation, Validation or Decision, in any case or as a prefix ('calc'). See GET /api/rules/types.","examples":["Pricing"],"title":"Ruletype"},"description":"Condition, Pricing, Calculation, Validation or Decision, in any case or as a prefix ('calc'). See GET /api/rules/types."},{"name":"ruleName","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact rule name.","title":"Rulename"},"description":"Exact rule name."},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number, 1-based. Ignored without pageSize.","title":"Page"},"description":"Page number, 1-based. Ignored without pageSize."},{"name":"pageSize","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Rows per page. Omit to return every row on one page.","title":"Pagesize"},"description":"Rows per page. Omit to return every row on one page."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleValuesListOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-values/publish/lookup":{"get":{"tags":["Rule Values"],"summary":"Look up value versions by rule name (pickers)","description":"Value versions with their rule's name, newest first. Without `search`, the latest 20.","operationId":"search_published_rules_minimal_api_rule_values_publish_lookup_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive text the name contains.","examples":["loan"],"title":"Search"},"description":"Case-insensitive text the name contains."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ValueVersionLookupItem"},"title":"Response Search Published Rules Minimal Api Rule Values Publish Lookup Get"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-values/publish/{version_id}/toggle-approved":{"patch":{"tags":["Rule Values"],"summary":"Toggle published status on one value version (legacy alias)","description":"Toggle IsPublished on one RuleValueDefinitionVersion.","operationId":"toggle_publish_object_versions_approved_api_rule_values_publish__version_id__toggle_approved_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleValueDefinitionVersion.Id (not the rule's Id)","title":"Version Id"},"description":"RuleValueDefinitionVersion.Id (not the rule's Id)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishToggleApprovedOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/publish/{version_id}/toggle-published":{"patch":{"tags":["Rule Values"],"summary":"Toggle published status on one value version","description":"Toggle IsPublished on one RuleValueDefinitionVersion.","operationId":"toggle_publish_object_versions_approved_api_rule_values_publish__version_id__toggle_published_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleValueDefinitionVersion.Id (not the rule's Id)","title":"Version Id"},"description":"RuleValueDefinitionVersion.Id (not the rule's Id)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishToggleApprovedOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rule-values/publish/{version_id}/publish":{"patch":{"tags":["Rule Values"],"summary":"Publish / activate one value version","description":"Toggle IsPublished on one RuleValueDefinitionVersion.","operationId":"toggle_publish_object_versions_approved_api_rule_values_publish__version_id__publish_patch","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleValueDefinitionVersion.Id (not the rule's Id)","title":"Version Id"},"description":"RuleValueDefinitionVersion.Id (not the rule's Id)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishToggleApprovedOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules-ai/compile":{"post":{"tags":["Rules AI"],"summary":"Compile a natural-language rule","description":"Turn a sentence into a rule plan (conditions and actions) and rule text (`dsl`).\nSend the returned `session_id` to refine the same rule in later calls.","operationId":"compile_rule_api_rules_ai_compile_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompileIn"},"examples":{"prompt":{"summary":"Natural-language rule","value":{"prompt":"If applicant age is over 18 and income at least 5000, approve the loan"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompileOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[],"AppId":[]}]}},"/api/rules-ai/script":{"patch":{"tags":["Rules AI"],"summary":"Save compiled rule text","description":"Save rule text: a new rule without `id`, else overwrite that rule's text. Send\n`row_version` to be refused (409) if the rule changed since you read it.","operationId":"save_rule_api_rules_ai_script_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleSaveIn"},"examples":{"new":{"summary":"Save a new rule","value":{"Name":"Adult applicant","RawRule":"If(Applicant.age > 18) { Loan.status = \"approve\" }EndIf","RuleType":"Condition"}},"existing":{"summary":"Overwrite a rule's text","value":{"Id":"3fa85f64-5717-4562-b3fc-2c963f66afa6","Name":"Adult applicant","RawRule":"If(Applicant.age > 18) { Loan.status = \"approve\" }EndIf","RowVersion":"0x00000000000007D3"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleSaveOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[],"AppId":[]}]}},"/api/rules-ai/edit-from-prompt":{"post":{"tags":["Rules AI"],"summary":"Run the rules agent on a prompt","description":"AI rules agent: interprets a natural-language prompt and calls the relevant\nAPIs for rules, compose/pricing, rule functions, object versions, and publish.\n\nExamples:\n- \"Show the rule with id 32\"\n- \"Can you show me all published rules?\"\n- \"Publish rule with id 42\"\n- \"Show version history for rule 25\"\n- \"List rule functions\"","operationId":"edit_rule_from_prompt_endpoint_api_rules_ai_edit_from_prompt_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleEditFromPromptIn"},"examples":{"show":{"summary":"Read","value":{"prompt":"Show all published pricing rules"}},"change":{"summary":"Change (dry run)","description":"dry_run returns the change without saving it.","value":{"prompt":"Change the age limit of 'Adult applicant' to 21","dry_run":true}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleEditFromPromptOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[],"AppId":[]}]}},"/api/rules/{rule_id}/evaluate":{"post":{"tags":["Rule Evaluation"],"summary":"Evaluate a rule","description":"Run the rule against `context.formValues` (values by data type and attribute). Runs\n`versionId` when given, else `valueVersionId` if testing dynamic threshold values,\nelse the published version, else the current text; `source` in the response says which.","operationId":"evaluate_rule_api_rules__rule_id__evaluate_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Rule Id"},"description":"RuleDefinition.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleEvaluateRequest"},"examples":{"published":{"summary":"Run the published version","value":{"context":{"formValues":{"Applicant":{"age":30,"income":6000,"city":"Pune"}},"flatValues":{}}}},"version":{"summary":"Run one version","value":{"context":{"formValues":{"Applicant":{"age":30,"income":6000,"city":"Pune"}},"flatValues":{}},"RuleDefinitionVersionId":"9c1b2d7e-4a5f-4e3b-8d2c-1f0a6b7c8d9e"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleEvaluateResponse"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/rules/evaluate-batch":{"post":{"tags":["Rule Evaluation"],"summary":"Evaluate several rules","description":"Run each rule against one context. `outcomes` maps each targetNodeId (or ruleId) to whether it passed.","operationId":"evaluate_rules_batch_endpoint_api_rules_evaluate_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleEvaluateBatchRequest"},"examples":{"batch":{"summary":"Two rules","value":{"context":{"formValues":{"Applicant":{"age":30,"income":6000,"city":"Pune"}},"flatValues":{}},"rules":[{"RuleDefinitionId":"3fa85f64-5717-4562-b3fc-2c963f66afa6","targetNodeId":"approve"},{"RuleDefinitionId":"7d2f0c1e-8b3a-4c5d-9e6f-0a1b2c3d4e5f","targetNodeId":"review"}]}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleEvaluateBatchResponse"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[],"AppId":[]}]}},"/api/rules/offers/{offer_id}/evaluate":{"post":{"tags":["Rule Evaluation"],"summary":"Evaluate all rules attached to an offer","description":"Evaluates all active rules attached to an offer in order.\nReturns eligibility decision and breakdown of rule conditions.","operationId":"evaluate_offer_rules_endpoint_api_rules_offers__offer_id__evaluate_post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"offer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Offer.Id","title":"Offer Id"},"description":"Offer.Id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferEvaluateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferEvaluateResponse"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/ai/rule-agent/{rule_id}":{"post":{"tags":["AI Rule Agent"],"summary":"Evaluate a rule with the AI agent","description":"The AI evaluates the rule against `context` and explains the outcome. Add-ons:\n`report` adds a findings report, `human-escalation` records an escalation for\n`performerId` when the outcome needs a person.","operationId":"ai_rule_agent_endpoint_api_ai_rule_agent__rule_id__post","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"RuleDefinition.Id","title":"Rule Id"},"description":"RuleDefinition.Id"}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/AiRuleAgentForm"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiRuleAgentOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not found in the X-App-Id application.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}}}},"/api/ai-usage":{"get":{"tags":["AI Usage"],"summary":"AI token usage of the application","description":"Requests, input / output / total tokens and duration from dbo.AiTokenUsage, with a breakdown.","operationId":"get_ai_usage_api_ai_usage_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"First day (UTC), YYYY-MM-DD","title":"From"},"description":"First day (UTC), YYYY-MM-DD"},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Last day (UTC), inclusive","title":"To"},"description":"Last day (UTC), inclusive"},{"name":"serviceName","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"e.g. rule-ai-api; all services when omitted","title":"Servicename"},"description":"e.g. rule-ai-api; all services when omitted"},{"name":"groupBy","in":"query","required":false,"schema":{"type":"string","description":"Breakdown by day, model, requestType or service.","examples":["day"],"default":"day","title":"Groupby"},"description":"Breakdown by day, model, requestType or service."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiUsageOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/data-quality":{"get":{"tags":["Data Quality"],"summary":"Scan data quality issues across rules and values","description":"Automated scan detecting duplicate rule bodies, orphaned value versions, overlapping condition ranges, and rules whose bodies or rule text cannot be read or run.","operationId":"get_data_quality_api_data_quality_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataQualityReportResponse"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}}},"security":[{"APIKeyHeader":[],"AppId":[]}]}},"/api/transfer/export":{"get":{"tags":["Transfer"],"summary":"Export rules and metadata to CSV, JSON, Word, or PDF","description":"Export data in the specified format and dataset type.\n\n- **format**: csv, json, word, or pdf (lowercase)\n- **dataset**: all (defaults to rules_manager), rules_manager, rules_function, rules_version, or rules_publish\n\nReturns a file download with the exported data.","operationId":"export_data_api_transfer_export_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"format","in":"query","required":true,"schema":{"$ref":"#/components/schemas/ExportFormat","description":"Export format: csv, json, word, or pdf"},"description":"Export format: csv, json, word, or pdf"},{"name":"dataset","in":"query","required":true,"schema":{"$ref":"#/components/schemas/DatasetType","description":"Dataset type: all, rules_manager, rules_function, rules_version, or rules_publish"},"description":"Dataset type: all, rules_manager, rules_function, rules_version, or rules_publish"}],"responses":{"200":{"description":"The export as a file download.","content":{"application/json":{"schema":{}},"text/csv":{},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{},"application/pdf":{}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/audit":{"get":{"tags":["Utilities"],"summary":"Query audit logs with date filters and pagination","description":"Retrieve structured JSON Lines audit records with date range, error type, and status code filters.","operationId":"get_audit_logs_endpoint_api_audit_get","security":[{"APIKeyHeader":[],"AppId":[]}],"parameters":[{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Date in YYYY-MM-DD format. Filter entries to this date.","title":"Date"},"description":"Date in YYYY-MM-DD format. Filter entries to this date."},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date in YYYY-MM-DD format (inclusive)","title":"Date From"},"description":"Start date in YYYY-MM-DD format (inclusive)"},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End date in YYYY-MM-DD format (inclusive)","title":"Date To"},"description":"End date in YYYY-MM-DD format (inclusive)"},{"name":"error_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by error type","title":"Error Type"},"description":"Filter by error type"},{"name":"status_code","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Filter by HTTP status code","title":"Status Code"},"description":"Filter by HTTP status code"},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date/time in ISO format","title":"Start Date"},"description":"Start date/time in ISO format"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End date/time in ISO format","title":"End Date"},"description":"End date/time in ISO format"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of entries to return","default":10,"title":"Limit"},"description":"Maximum number of entries to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page index (1-based)","default":1,"title":"Offset"},"description":"Page index (1-based)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditLogsOut"}}}},"400":{"description":"X-App-Id missing or not a GUID, or the request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"X-Internal-Auth missing or wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ActionItem":{"properties":{"target_data_type":{"type":"string","title":"Target Data Type"},"target_attribute":{"type":"string","title":"Target Attribute"},"literal_value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"integer"},{"type":"null"}],"title":"Literal Value"},"expression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expression"}},"type":"object","required":["target_data_type","target_attribute"],"title":"ActionItem"},"AiRuleAgentForm":{"properties":{"context":{"type":"string","title":"Context","description":"JSON context with formValues, flatValues, and workflow metadata","default":"{}","examples":["{\"formValues\": {\"Applicant\": {\"age\": 30}}}"]},"prompt":{"type":"string","title":"Prompt","description":"Instructions for how the AI should evaluate the rule","default":"Evaluate configured business rules for this task and use the result to route to the next task in the workflow."},"model":{"type":"string","title":"Model","description":"OpenAI model: gpt-4o or gpt-4.1","default":"gpt-4o"},"temperature":{"type":"number","maximum":2.0,"minimum":0.0,"title":"Temperature","description":"Sampling temperature (0-2)","default":0.2},"addOns":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Addons","description":"JSON array of add-ons, e.g. [\"report\",\"human-escalation\"]"},"performerId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Performerid","description":"Performer or role id to notify when human escalation is required"}},"type":"object","title":"AiRuleAgentForm","description":"The rule agent's form fields (multipart/form-data or x-www-form-urlencoded)."},"AiRuleAgentOut":{"properties":{"Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"RuleDefinition.Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id"},"RuleName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulename","description":"RuleDefinition.Name"},"Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"RuleDefinition.Name"},"ruleId":{"type":"string","title":"Ruleid"},"ruleName":{"type":"string","title":"Rulename"},"passed":{"type":"boolean","title":"Passed"},"confidence":{"type":"number","title":"Confidence","default":1.0},"notes":{"type":"string","title":"Notes","default":""},"outcomes":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Outcomes"},"model":{"type":"string","title":"Model"},"temperature":{"type":"number","title":"Temperature"},"prompt":{"type":"string","title":"Prompt"},"evaluationMode":{"type":"string","enum":["deterministic","prompt","hybrid"],"title":"Evaluationmode","default":"deterministic"},"report":{"anyOf":[{"$ref":"#/components/schemas/RuleAgentReport"},{"type":"null"}]},"escalation":{"anyOf":[{"$ref":"#/components/schemas/RuleAgentEscalation"},{"type":"null"}]},"extractedContext":{"type":"object","title":"Extractedcontext"}},"type":"object","required":["ruleId","ruleName","passed","model","temperature","prompt"],"title":"AiRuleAgentOut"},"AiUsageOut":{"properties":{"ApplicationId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid","description":"dbo.AiTokenUsage.ApplicationId"},"applicationId":{"type":"string","format":"uuid","title":"Applicationid"},"from":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From"},"to":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To"},"groupBy":{"type":"string","title":"Groupby"},"totals":{"$ref":"#/components/schemas/UsageMeasures"},"groups":{"items":{"$ref":"#/components/schemas/UsageGroup"},"type":"array","title":"Groups"}},"additionalProperties":true,"type":"object","required":["applicationId","groupBy","totals","groups"],"title":"AiUsageOut"},"AppStatsResponse":{"properties":{"app":{"type":"string","title":"App","description":"Application service name"},"version":{"type":"string","title":"Version","description":"Application release version"},"uptime_sec":{"type":"number","title":"Uptime Sec","description":"Process uptime in seconds"},"status":{"type":"string","title":"Status","description":"Operational status","default":"ok"}},"type":"object","required":["app","version","uptime_sec"],"title":"AppStatsResponse","example":{"app":"WorkFINITY® Rules AI API","status":"ok","uptime_sec":3600.5,"version":"1.0.0"}},"AuditLogEntry":{"properties":{"timestamp":{"type":"string","title":"Timestamp","description":"Timestamp of the audit entry in ISO format"},"error_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Type","description":"Category of error, e.g. INTERNAL_SERVER_ERROR, AI_ERROR, DATABASE_ERROR, AUTH_ERROR, VALIDATION_ERROR, TIMEOUT_ERROR, NOT_FOUND"},"status_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status Code","description":"HTTP response status code"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message","description":"Error message text"},"error_details":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Details","description":"Detailed traceback or error context"},"response_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Response Time Ms","description":"Request execution duration in milliseconds"},"user_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Identifier","description":"User, IP, or session identifier"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address","description":"Client IP address"},"user_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Agent","description":"Client user agent string"},"request":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Request","description":"Sanitized HTTP request context (method, path, headers, query_params)"}},"additionalProperties":true,"type":"object","required":["timestamp"],"title":"AuditLogEntry"},"AuditLogsDebug":{"properties":{"audit_log_file":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audit Log File","description":"Relative path of the audit log file"},"audit_log_file_absolute":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audit Log File Absolute","description":"Absolute path of the audit log file"},"file_exists":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"File Exists","description":"Whether the audit log file exists on disk"},"read_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Read Error","description":"Error message if reading the audit log file failed"}},"additionalProperties":true,"type":"object","title":"AuditLogsDebug"},"AuditLogsFilters":{"properties":{"error_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Type","description":"Filter applied for error type"},"status_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status Code","description":"Filter applied for status code"},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Date","description":"Filter applied for start date"},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Date","description":"Filter applied for end date"}},"additionalProperties":true,"type":"object","title":"AuditLogsFilters"},"AuditLogsOut":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/AuditLogEntry"},"type":"array","title":"Entries","description":"Paginated audit log entries"},"total":{"type":"integer","title":"Total","description":"Total count of entries matching the filter criteria"},"page":{"type":"integer","title":"Page","description":"Current page index (1-based)"},"limit":{"type":"integer","title":"Limit","description":"Maximum number of entries per page"},"offset":{"type":"integer","title":"Offset","description":"Offset / page index used for query"},"filters":{"anyOf":[{"$ref":"#/components/schemas/AuditLogsFilters"},{"type":"null"}],"description":"Query filters applied to the result"},"debug":{"anyOf":[{"$ref":"#/components/schemas/AuditLogsDebug"},{"type":"null"}],"description":"Diagnostic filesystem info for the audit file"}},"additionalProperties":true,"type":"object","required":["total","page","limit","offset"],"title":"AuditLogsOut"},"BatchRuleItem":{"properties":{"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"RuleDefinition.RuleType"},"RuleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid","description":"RuleDefinitionVersion.Id"},"RuleValueDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rulevaluedefinitionversionid","description":"RuleValueDefinitionVersion.Id"},"usePublishedValues":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Usepublishedvalues","default":false},"targetNodeId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Targetnodeid"},"ruleId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruleid","description":"Legacy alias for RuleDefinitionId"},"ruleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"Legacy alias for RuleType"},"versionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Versionid","description":"Legacy alias for RuleDefinitionVersionId"},"valueVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Valueversionid","description":"Legacy alias for RuleValueDefinitionVersionId"}},"type":"object","title":"BatchRuleItem"},"BatchRuleResult":{"properties":{"Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"RuleDefinition.Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id"},"RuleName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulename","description":"RuleDefinition.Name"},"Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"RuleDefinition.Name"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"RuleDefinition.RuleType"},"RuleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid","description":"RuleDefinitionVersion.Id"},"RuleValueDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rulevaluedefinitionversionid","description":"RuleValueDefinitionVersion.Id"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version","description":"Version number that ran"},"ValueVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Valueversion","description":"Value version number that ran"},"ruleId":{"type":"string","title":"Ruleid"},"targetNodeId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Targetnodeid"},"passed":{"type":"boolean","title":"Passed"},"reason":{"type":"string","title":"Reason"},"ruleName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulename"},"ruleVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ruleversion"},"source":{"type":"string","enum":["version","published","current","value_version","published_values","offer_values"],"title":"Source","default":"current"}},"type":"object","required":["ruleId","passed","reason"],"title":"BatchRuleResult"},"CheckRequest":{"properties":{"Notes":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Notes"}},"type":"object","title":"CheckRequest","description":"Optional notes recorded with a check-out or check-in."},"CommentIn":{"properties":{"text":{"type":"string","title":"Text","description":"The comment; stored as the rule's UpdatedNotes.","examples":["Reviewed with credit team"]}},"type":"object","required":["text"],"title":"CommentIn"},"CompileIn":{"properties":{"prompt":{"type":"string","title":"Prompt"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},"type":"object","required":["prompt"],"title":"CompileIn"},"CompileOut":{"properties":{"plan":{"anyOf":[{"$ref":"#/components/schemas/RulePlan"},{"type":"null"}]},"dsl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dsl"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"rules":{"anyOf":[{"items":{"$ref":"#/components/schemas/RuleRecord"},"type":"array"},{"type":"null"}],"title":"Rules"},"rules_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rules Count"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"ExecutionTimeSec":{"type":"number","title":"Executiontimesec","description":"Seconds taken to finish after the request input is received","default":0.0}},"type":"object","title":"CompileOut"},"ConditionAtom":{"properties":{"data_type":{"type":"string","title":"Data Type"},"attribute":{"type":"string","title":"Attribute"},"operator":{"type":"string","title":"Operator"},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"integer"}],"title":"Value"}},"type":"object","required":["data_type","attribute","operator","value"],"title":"ConditionAtom"},"ConditionDiffBlock":{"properties":{"added":{"items":{"type":"object"},"type":"array","title":"Added"},"removed":{"items":{"type":"object"},"type":"array","title":"Removed"},"modified":{"items":{"$ref":"#/components/schemas/ConditionDiffItem"},"type":"array","title":"Modified"}},"type":"object","title":"ConditionDiffBlock"},"ConditionDiffItem":{"properties":{"attribute":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attribute"},"dataType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Datatype"},"operator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Operator"},"oldValue":{"anyOf":[{},{"type":"null"}],"title":"Oldvalue"},"newValue":{"anyOf":[{},{"type":"null"}],"title":"Newvalue"},"changeType":{"type":"string","title":"Changetype","default":"modified"}},"type":"object","title":"ConditionDiffItem"},"ConditionsBlock":{"properties":{"atoms":{"items":{"$ref":"#/components/schemas/ConditionAtom"},"type":"array","title":"Atoms"},"connectors":{"items":{"type":"string"},"type":"array","title":"Connectors"},"groups":{"anyOf":[{"items":{"items":{"type":"integer"},"type":"array"},"type":"array"},{"type":"null"}],"title":"Groups"}},"type":"object","required":["atoms","connectors"],"title":"ConditionsBlock"},"ConflictItem":{"properties":{"ruleId1":{"type":"string","format":"uuid","title":"Ruleid1"},"ruleName1":{"type":"string","title":"Rulename1"},"ruleId2":{"type":"string","format":"uuid","title":"Ruleid2"},"ruleName2":{"type":"string","title":"Rulename2"},"attribute":{"type":"string","title":"Attribute"},"dataType":{"type":"string","title":"Datatype"},"conflictType":{"type":"string","title":"Conflicttype"},"explanation":{"type":"string","title":"Explanation"},"severity":{"type":"string","title":"Severity","default":"High"}},"type":"object","required":["ruleId1","ruleName1","ruleId2","ruleName2","attribute","dataType","conflictType","explanation"],"title":"ConflictItem"},"DataQualityReportResponse":{"properties":{"duplicates":{"items":{"type":"object"},"type":"array","title":"Duplicates","description":"Duplicate rule body rows"},"orphans":{"items":{"type":"object"},"type":"array","title":"Orphans","description":"Orphaned rule value records referencing inactive definitions"},"overlaps":{"items":{"type":"object"},"type":"array","title":"Overlaps","description":"Rules with overlapping condition ranges"},"formatIssues":{"items":{"type":"object"},"type":"array","title":"Formatissues","description":"Rules whose ScriptBody / PricingScriptBody is not a JSON row array, or whose RawRule has no If(...){...}EndIf block"},"summary":{"$ref":"#/components/schemas/DataQualitySummary","description":"Summary counts of data quality issues"}},"type":"object","required":["summary"],"title":"DataQualityReportResponse","example":{"duplicates":[],"formatIssues":[],"orphans":[],"overlaps":[],"summary":{"duplicates":0,"formatIssues":0,"orphans":0,"overlaps":0}}},"DataQualitySummary":{"properties":{"duplicates":{"type":"integer","title":"Duplicates","description":"Total count of duplicate rule entries","default":0},"orphans":{"type":"integer","title":"Orphans","description":"Total count of orphaned value records","default":0},"overlaps":{"type":"integer","title":"Overlaps","description":"Total count of overlapping condition ranges","default":0},"formatIssues":{"type":"integer","title":"Formatissues","description":"Total count of rules with unreadable bodies or a RawRule that cannot run","default":0}},"type":"object","title":"DataQualitySummary"},"DatasetType":{"type":"string","enum":["all","rules_manager","rules_function","rules_version","rules_publish"],"title":"DatasetType"},"DbPingResponse":{"properties":{"ok":{"type":"boolean","title":"Ok","description":"Database connection test status","default":true},"app":{"type":"string","title":"App","description":"Application name"}},"type":"object","required":["app"],"title":"DbPingResponse","example":{"app":"WorkFINITY® Rules AI API","ok":true}},"ErrorOut":{"properties":{"detail":{"title":"Detail","description":"What went wrong.","examples":["Rule not found"]}},"type":"object","required":["detail"],"title":"ErrorOut"},"ExportFormat":{"type":"string","enum":["csv","json","word","pdf"],"title":"ExportFormat"},"FunctionCreate":{"properties":{"Name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name","description":"Rule function name."},"FunctionKey":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Functionkey","description":"Lowercase identifier [-_0-9a-z], unique per application."},"FunctionType":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Functiontype","description":"Function category or group."},"ReturnType":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Returntype","description":"Return data type (defaults to Any)."},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Function description."},"SampleText":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sampletext","description":"Sample function invocation text."},"IsImplemented":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isimplemented","description":"Whether backed by implementation code."},"ImplementationKey":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Implementationkey","description":"Implementation class/method identifier."},"ImplementationVersion":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Implementationversion","description":"Implementation code version."},"IsActive":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isactive","description":"Whether the function is active and approved for use."},"ApplicationId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid","description":"Application GUID. Scoped to X-App-Id."},"CreatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Createdbyuserid","description":"User GUID who created the function."},"UpdatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Updatedbyuserid","description":"User GUID who last updated the function."},"UpdatedNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updatednotes","description":"Notes on the update."},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion","description":"RowVersion concurrency token."},"FunctionName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Functionname","description":"Legacy alias for Name."},"Example":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Example","description":"Legacy alias for SampleText."},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy alias for IsActive (1 / 0)."},"Configured":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Configured","description":"Legacy alias for IsImplemented."},"ApplicationID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid","description":"Legacy alias for ApplicationId."},"Parameters":{"anyOf":[{"items":{"$ref":"#/components/schemas/FunctionParamIn"},"type":"array"},{"type":"null"}],"title":"Parameters","description":"List of function parameters (RuleFunctionParameter)."},"params":{"anyOf":[{"items":{"$ref":"#/components/schemas/FunctionParamIn"},"type":"array"},{"type":"null"}],"title":"Params","description":"Legacy alias for Parameters."}},"type":"object","title":"FunctionCreate"},"FunctionLookupItem":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id","description":"RuleFunction.Id"},"Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"FunctionKey":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Functionkey"},"IsActive":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isactive","description":"RuleFunction.IsActive"},"ID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"Legacy alias for Id"},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy IsActive, 1 / 0"}},"additionalProperties":true,"type":"object","required":["Id"],"title":"FunctionLookupItem"},"FunctionOut":{"properties":{"Name":{"type":"string","title":"Name"},"FunctionKey":{"type":"string","title":"Functionkey"},"FunctionType":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Functiontype","description":"Function category or group."},"ReturnType":{"type":"string","title":"Returntype","default":"Any"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Function description."},"SampleText":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sampletext","description":"Sample function invocation text."},"IsImplemented":{"type":"boolean","title":"Isimplemented","default":false},"ImplementationKey":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Implementationkey","description":"Implementation class/method identifier."},"ImplementationVersion":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Implementationversion","description":"Implementation code version."},"IsActive":{"type":"boolean","title":"Isactive","default":true},"ApplicationId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid","description":"Application GUID. Scoped to X-App-Id."},"CreatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Createdbyuserid","description":"User GUID who created the function."},"UpdatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Updatedbyuserid","description":"User GUID who last updated the function."},"UpdatedNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updatednotes","description":"Notes on the update."},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion","description":"RowVersion concurrency token."},"FunctionName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Functionname","description":"Legacy alias for Name."},"Example":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Example","description":"Legacy alias for SampleText."},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy alias for IsActive (1 / 0)."},"Configured":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Configured","description":"Legacy alias for IsImplemented."},"ApplicationID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid","description":"Legacy alias for ApplicationId."},"Id":{"type":"string","format":"uuid","title":"Id"},"CreatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Createdatutc"},"UpdatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updatedatutc"},"Parameters":{"items":{"$ref":"#/components/schemas/FunctionParamOut"},"type":"array","title":"Parameters","description":"Function parameters from dbo.RuleFunctionParameter."},"ParamCount":{"type":"integer","title":"Paramcount","default":0},"DateTimeCreated":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Datetimecreated"},"ModifiedDate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modifieddate"},"params":{"items":{"$ref":"#/components/schemas/FunctionParamOut"},"type":"array","title":"Params","description":"Legacy alias for Parameters."}},"type":"object","required":["Name","FunctionKey","Id"],"title":"FunctionOut"},"FunctionParamIn":{"properties":{"ParameterName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parametername","description":"Parameter name. Letters, digits, '-' and '_' only."},"ParameterType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parametertype","description":"Data type of the parameter."},"OrderNumber":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ordernumber","description":"1-based parameter order position."},"IsRequired":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isrequired","description":"Whether the parameter is required."},"DefaultValue":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Defaultvalue","description":"Default value if not provided."},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Parameter description."},"ValidationSchemaJson":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validationschemajson","description":"JSON validation schema."},"IsActive":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isactive","description":"Whether the parameter is active."},"ParamName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paramname","description":"Legacy alias for ParameterName."},"ParamType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paramtype","description":"Legacy alias for ParameterType."}},"type":"object","title":"FunctionParamIn","description":"A parameter as stored in dbo.RuleFunctionParameter:\n\n    ParameterName         letters, digits, '-' and '_' only; unique per function\n    ParameterType         data type of the parameter\n    OrderNumber           1-based sequence order (defaults to position)\n    IsRequired            whether parameter is required (default True)\n    DefaultValue          default expression or constant\n    Description           parameter documentation\n    ValidationSchemaJson  optional JSON validation schema\n    IsActive              usable by rules (default True)"},"FunctionParamOut":{"properties":{"ParameterName":{"type":"string","title":"Parametername"},"ParameterType":{"type":"string","title":"Parametertype"},"OrderNumber":{"type":"integer","title":"Ordernumber","default":1},"IsRequired":{"type":"boolean","title":"Isrequired","default":true},"DefaultValue":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Defaultvalue"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"ValidationSchemaJson":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validationschemajson"},"IsActive":{"type":"boolean","title":"Isactive","default":true},"ParamName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paramname"},"ParamType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paramtype"},"Id":{"type":"string","format":"uuid","title":"Id"},"RuleFunctionId":{"type":"string","format":"uuid","title":"Rulefunctionid"},"CreatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Createdbyuserid"},"CreatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Createdatutc"},"UpdatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Updatedbyuserid"},"UpdatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updatedatutc"},"UpdatedNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updatednotes"},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion"},"FunctionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Functionid"}},"type":"object","required":["ParameterName","ParameterType","Id","RuleFunctionId"],"title":"FunctionParamOut"},"FunctionUpdate":{"properties":{"Name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name","description":"Rule function name."},"FunctionKey":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Functionkey","description":"Lowercase identifier [-_0-9a-z], unique per application."},"FunctionType":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Functiontype","description":"Function category or group."},"ReturnType":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Returntype","description":"Return data type (defaults to Any)."},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Function description."},"SampleText":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sampletext","description":"Sample function invocation text."},"IsImplemented":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isimplemented","description":"Whether backed by implementation code."},"ImplementationKey":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Implementationkey","description":"Implementation class/method identifier."},"ImplementationVersion":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Implementationversion","description":"Implementation code version."},"IsActive":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isactive","description":"Whether the function is active and approved for use."},"ApplicationId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid","description":"Application GUID. Scoped to X-App-Id."},"CreatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Createdbyuserid","description":"User GUID who created the function."},"UpdatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Updatedbyuserid","description":"User GUID who last updated the function."},"UpdatedNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updatednotes","description":"Notes on the update."},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion","description":"RowVersion concurrency token."},"FunctionName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Functionname","description":"Legacy alias for Name."},"Example":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Example","description":"Legacy alias for SampleText."},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy alias for IsActive (1 / 0)."},"Configured":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Configured","description":"Legacy alias for IsImplemented."},"ApplicationID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid","description":"Legacy alias for ApplicationId."},"Parameters":{"anyOf":[{"items":{"$ref":"#/components/schemas/FunctionParamIn"},"type":"array"},{"type":"null"}],"title":"Parameters","description":"If provided, replaces all existing parameter rows."},"params":{"anyOf":[{"items":{"$ref":"#/components/schemas/FunctionParamIn"},"type":"array"},{"type":"null"}],"title":"Params","description":"Legacy alias for Parameters."}},"type":"object","title":"FunctionUpdate"},"FunctionsListOut":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FunctionOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"pageSize":{"type":"integer","title":"Pagesize"}},"type":"object","required":["items","total","page","pageSize"],"title":"FunctionsListOut"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status","description":"Service operational status","default":"ok"},"prompt_loaded":{"type":"boolean","title":"Prompt Loaded","description":"Indicates whether AI prompt file exists and is accessible","default":true},"env_loaded":{"type":"boolean","title":"Env Loaded","description":"Indicates whether OpenAI API key is detected in the environment","default":true},"version":{"type":"string","title":"Version","description":"API version string","default":"1.0.0"}},"type":"object","title":"HealthResponse","example":{"env_loaded":true,"prompt_loaded":true,"status":"ok","version":"1.0.0"}},"ImportFileForm":{"properties":{"file":{"type":"string","format":"binary","title":"File","description":"The rows as a .csv or .json file (UTF-8, max 15 MB)"}},"type":"object","required":["file"],"title":"ImportFileForm","description":"The multipart body of an import, as a named schema (use with Annotated[ImportFileForm, Form()])."},"ImportResult":{"properties":{"ok":{"type":"boolean","title":"Ok"},"dryRun":{"type":"boolean","title":"Dryrun"},"entity":{"type":"string","title":"Entity"},"summary":{"$ref":"#/components/schemas/ImportSummary"},"errors":{"items":{"$ref":"#/components/schemas/ImportRowError"},"type":"array","title":"Errors","default":[]}},"type":"object","required":["ok","dryRun","entity","summary"],"title":"ImportResult"},"ImportRowError":{"properties":{"row":{"type":"integer","title":"Row"},"key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["row","reason"],"title":"ImportRowError"},"ImportSummary":{"properties":{"created":{"type":"integer","title":"Created","default":0},"skipped":{"type":"integer","title":"Skipped","default":0},"errors":{"type":"integer","title":"Errors","default":0}},"type":"object","title":"ImportSummary"},"MessageOut":{"properties":{"message":{"type":"string","title":"Message","examples":["Deleted Successfully"]},"id":{"type":"string","format":"uuid","title":"Id"}},"additionalProperties":true,"type":"object","required":["message","id"],"title":"MessageOut"},"OfferDependencyItem":{"properties":{"offerId":{"type":"string","format":"uuid","title":"Offerid"},"offerName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Offername"},"offerCode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Offercode"},"orderNumber":{"type":"integer","title":"Ordernumber","default":0},"ruleRole":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulerole"},"isEnabled":{"type":"boolean","title":"Isenabled","default":true},"partnerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Partnerid"},"partnerName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Partnername"}},"type":"object","required":["offerId"],"title":"OfferDependencyItem"},"OfferEvaluateRequest":{"properties":{"context":{"$ref":"#/components/schemas/RuleEvaluationContext"},"shortCircuit":{"type":"boolean","title":"Shortcircuit","description":"Stop immediately on first failing rule","default":false},"usePublishedValues":{"type":"boolean","title":"Usepublishedvalues","description":"Evaluate with active published rule values","default":true},"ruleRole":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulerole","description":"Optional role filter (e.g. Eligibility, Pricing)"}},"type":"object","required":["context"],"title":"OfferEvaluateRequest"},"OfferEvaluateResponse":{"properties":{"offerId":{"type":"string","format":"uuid","title":"Offerid"},"eligible":{"type":"boolean","title":"Eligible"},"totalRules":{"type":"integer","title":"Totalrules"},"passedRules":{"type":"integer","title":"Passedrules"},"failedRules":{"type":"integer","title":"Failedrules"},"shortCircuited":{"type":"boolean","title":"Shortcircuited","default":false},"firstFailedRule":{"anyOf":[{"$ref":"#/components/schemas/OfferRuleEvaluationItem"},{"type":"null"}]},"ruleResults":{"items":{"$ref":"#/components/schemas/OfferRuleEvaluationItem"},"type":"array","title":"Ruleresults"}},"type":"object","required":["offerId","eligible","totalRules","passedRules","failedRules"],"title":"OfferEvaluateResponse"},"OfferRuleAttachIn":{"properties":{"ruleDefinitionId":{"type":"string","format":"uuid","title":"Ruledefinitionid","description":"RuleDefinition.Id to attach to the offer"},"ruleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid","description":"Optional pinned RuleDefinitionVersion.Id (defaults to latest published)"},"orderNumber":{"type":"integer","title":"Ordernumber","description":"Evaluation sequence order (defaults to 0)","default":0},"ruleRole":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulerole","description":"Role in offer context: Eligibility, Pricing, Validation, Scoring, Decision"},"isEnabled":{"type":"boolean","title":"Isenabled","description":"Active status for this offer","default":true},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Notes on why this rule is attached to the offer"}},"type":"object","required":["ruleDefinitionId"],"title":"OfferRuleAttachIn"},"OfferRuleBulkIn":{"properties":{"replaceExisting":{"type":"boolean","title":"Replaceexisting","description":"When true, replaces all currently attached rules for this offer. When false, upserts the provided list.","default":false},"rules":{"items":{"$ref":"#/components/schemas/OfferRuleBulkItem"},"type":"array","title":"Rules","description":"List of rules to attach/update"}},"type":"object","required":["rules"],"title":"OfferRuleBulkIn"},"OfferRuleBulkItem":{"properties":{"ruleDefinitionId":{"type":"string","format":"uuid","title":"Ruledefinitionid","description":"RuleDefinition.Id"},"ruleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid"},"orderNumber":{"type":"integer","title":"Ordernumber","description":"Evaluation order","default":0},"ruleRole":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulerole","description":"Rule role in offer context","default":"Eligibility"},"isEnabled":{"type":"boolean","title":"Isenabled","description":"Active status","default":true},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["ruleDefinitionId"],"title":"OfferRuleBulkItem"},"OfferRuleBulkOut":{"properties":{"offerId":{"type":"string","format":"uuid","title":"Offerid"},"attachedCount":{"type":"integer","title":"Attachedcount"},"items":{"items":{"$ref":"#/components/schemas/OfferRuleOut"},"type":"array","title":"Items"}},"type":"object","required":["offerId","attachedCount","items"],"title":"OfferRuleBulkOut"},"OfferRuleDeleteOut":{"properties":{"message":{"type":"string","title":"Message","description":"Status message"},"offerId":{"type":"string","format":"uuid","title":"Offerid","description":"Target Offer.Id"},"ruleId":{"type":"string","format":"uuid","title":"Ruleid","description":"Detached RuleDefinition.Id"}},"type":"object","required":["message","offerId","ruleId"],"title":"OfferRuleDeleteOut"},"OfferRuleEvaluationItem":{"properties":{"ruleId":{"type":"string","format":"uuid","title":"Ruleid"},"ruleName":{"type":"string","title":"Rulename"},"orderNumber":{"type":"integer","title":"Ordernumber"},"ruleRole":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulerole"},"passed":{"type":"boolean","title":"Passed"},"reason":{"type":"string","title":"Reason"},"matchedConditions":{"items":{"type":"string"},"type":"array","title":"Matchedconditions"},"failedConditions":{"items":{"type":"string"},"type":"array","title":"Failedconditions"},"source":{"type":"string","title":"Source","default":"current"},"version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version"},"valueVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Valueversion"}},"type":"object","required":["ruleId","ruleName","orderNumber","passed","reason"],"title":"OfferRuleEvaluationItem"},"OfferRuleOut":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id","description":"OfferRule.Id"},"OfferId":{"type":"string","format":"uuid","title":"Offerid","description":"Offer.Id"},"RuleDefinitionId":{"type":"string","format":"uuid","title":"Ruledefinitionid","description":"RuleDefinition.Id"},"RuleName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulename","description":"RuleDefinition.Name"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"RuleDefinition.RuleType (Condition, Pricing, Calculation, Validation, Decision)"},"RuleRole":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulerole","description":"OfferRule.RuleRole (e.g. Eligibility, Pricing, Validation, Scoring)"},"OrderNumber":{"type":"integer","title":"Ordernumber","description":"Evaluation order number within the offer","default":0},"IsEnabled":{"type":"boolean","title":"Isenabled","description":"Whether this rule is active for this offer","default":true},"RuleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid","description":"Pinned RuleDefinitionVersion.Id if any"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version","description":"Rule version number"},"RawRule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawrule","description":"Rule text e.g. If(...) { ... } EndIf"},"ScriptBody":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Scriptbody","description":"Parsed condition comparison rows"},"PricingScriptBody":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Pricingscriptbody","description":"Parsed pricing adjustment rows"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Offer rule description / notes"},"CreatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Createdatutc"},"id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id"},"offerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Offerid"},"ruleId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruleid"},"ruleName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulename"},"ruleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype"},"ruleRole":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulerole"},"orderNumber":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ordernumber"},"isEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isenabled"},"versionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Versionid"}},"type":"object","required":["Id","OfferId","RuleDefinitionId"],"title":"OfferRuleOut","description":"A rule attached to an offer from dbo.OfferRule joined with dbo.RuleDefinition."},"OfferRuleReorderIn":{"properties":{"items":{"items":{"$ref":"#/components/schemas/OfferRuleReorderItem"},"type":"array","title":"Items","description":"List of rule IDs with new order numbers"}},"type":"object","required":["items"],"title":"OfferRuleReorderIn"},"OfferRuleReorderItem":{"properties":{"ruleDefinitionId":{"type":"string","format":"uuid","title":"Ruledefinitionid"},"orderNumber":{"type":"integer","title":"Ordernumber","description":"New sequence order number"}},"type":"object","required":["ruleDefinitionId","orderNumber"],"title":"OfferRuleReorderItem"},"OfferRuleReorderOut":{"properties":{"offerId":{"type":"string","format":"uuid","title":"Offerid"},"updatedCount":{"type":"integer","title":"Updatedcount"},"items":{"items":{"$ref":"#/components/schemas/OfferRuleOut"},"type":"array","title":"Items"}},"type":"object","required":["offerId","updatedCount","items"],"title":"OfferRuleReorderOut"},"OfferRulesListOut":{"properties":{"offerId":{"type":"string","format":"uuid","title":"Offerid"},"offerName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Offername"},"offerCode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Offercode"},"items":{"items":{"$ref":"#/components/schemas/OfferRuleOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["offerId","items","total"],"title":"OfferRulesListOut"},"OfferToggleData":{"properties":{"items":{"items":{},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"pageSize":{"type":"integer","title":"Pagesize"},"pages":{"type":"integer","title":"Pages"}},"additionalProperties":true,"type":"object","required":["items","total","page","pageSize","pages"],"title":"OfferToggleData"},"OfferToggleOut":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"data":{"$ref":"#/components/schemas/OfferToggleData"}},"additionalProperties":true,"type":"object","required":["success","message","data"],"title":"OfferToggleOut"},"PartnerDependencyItem":{"properties":{"partnerId":{"type":"string","format":"uuid","title":"Partnerid"},"partnerName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Partnername"},"partnerCode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Partnercode"},"offerCount":{"type":"integer","title":"Offercount","default":0}},"type":"object","required":["partnerId"],"title":"PartnerDependencyItem"},"PartnerOfferRulesOut":{"properties":{"offerId":{"type":"string","format":"uuid","title":"Offerid","description":"Offer.Id"},"offerName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Offername","description":"Offer.Name"},"offerCode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Offercode","description":"Offer.OfferCode"},"offerType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Offertype","description":"Offer.OfferType"},"totalRules":{"type":"integer","title":"Totalrules","description":"Total rules linked to this offer","default":0},"rules":{"items":{"$ref":"#/components/schemas/OfferRuleOut"},"type":"array","title":"Rules","description":"Rules linked to this offer"}},"type":"object","required":["offerId"],"title":"PartnerOfferRulesOut","description":"An offer belonging to a partner with all rules linked to it."},"PartnerRulesOut":{"properties":{"partnerId":{"type":"string","format":"uuid","title":"Partnerid","description":"Partner.Id"},"partnerName":{"type":"string","title":"Partnername","description":"Partner.Name"},"partnerCode":{"type":"string","title":"Partnercode","description":"Partner.PartnerCode"},"partnerType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Partnertype","description":"Partner.PartnerType"},"totalOffers":{"type":"integer","title":"Totaloffers","description":"Total offers found for this partner","default":0},"totalRules":{"type":"integer","title":"Totalrules","description":"Total rule associations across all partner offers","default":0},"offers":{"items":{"$ref":"#/components/schemas/PartnerOfferRulesOut"},"type":"array","title":"Offers","description":"List of partner offers with their attached rules"},"rules":{"items":{"$ref":"#/components/schemas/OfferRuleOut"},"type":"array","title":"Rules","description":"Unified distinct rules associated with this partner"}},"type":"object","required":["partnerId","partnerName","partnerCode"],"title":"PartnerRulesOut","description":"Rules associated with a partner via the partner's commercial offers."},"PartnerRulesSearchListOut":{"properties":{"search":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search","description":"The search term used to match partner name or code"},"totalPartners":{"type":"integer","title":"Totalpartners","description":"Total matching partners found","default":0},"items":{"items":{"$ref":"#/components/schemas/PartnerRulesOut"},"type":"array","title":"Items","description":"Partners matching the search with their offers and rules"}},"type":"object","title":"PartnerRulesSearchListOut","description":"Results of searching partner rules by partner name or code."},"PlaceholderSets":{"properties":{"data_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Data Types"},"attributes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Attributes"}},"type":"object","title":"PlaceholderSets"},"PricingDiffBlock":{"properties":{"added":{"items":{"type":"object"},"type":"array","title":"Added"},"removed":{"items":{"type":"object"},"type":"array","title":"Removed"},"modified":{"items":{"type":"object"},"type":"array","title":"Modified"}},"type":"object","title":"PricingDiffBlock"},"PricingIn":{"properties":{"Data_Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data Type"},"Attribute_Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attribute Name"},"Operator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Operator"},"Value_Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Type"},"Expression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expression"},"ExpressionJson":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expressionjson"},"Exp_DataType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exp Datatype"},"Exp_Attribute":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exp Attribute"},"Exp_Value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exp Value"},"StartGroup":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Startgroup"},"EndGroup":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Endgroup"},"RootValue":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rootvalue"},"RootDataType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rootdatatype"},"RootAttribute":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rootattribute"}},"type":"object","title":"PricingIn","description":"One action / adjustment row of RuleDefinition.PricingScriptBody."},"PricingItem":{"properties":{"Data_Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data Type"},"Attribute_Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attribute Name"},"Operator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Operator"},"Value_Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Type"},"Expression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expression"},"ExpressionJson":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expressionjson"},"Exp_DataType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exp Datatype"},"Exp_Attribute":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exp Attribute"},"Exp_Value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exp Value"},"StartGroup":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Startgroup"},"EndGroup":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Endgroup"},"RootValue":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rootvalue"},"RootDataType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rootdatatype"},"RootAttribute":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rootattribute"},"Id":{"type":"integer","title":"Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid"},"Rule_Id":{"type":"string","format":"uuid","title":"Rule Id"}},"type":"object","required":["Id","Rule_Id"],"title":"PricingItem"},"PublishApprovedItem":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id","description":"RuleValueDefinitionVersion.Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id"},"IsPublished":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ispublished","description":"Whether published."},"Rule_Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rule Id","description":"Legacy alias for RuleDefinitionId."},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy alias for IsPublished (1 / 0)."}},"type":"object","required":["Id"],"title":"PublishApprovedItem"},"PublishToggleApprovedOut":{"properties":{"Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid"},"Rule_Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rule Id"},"updated":{"type":"integer","title":"Updated"},"items":{"items":{"$ref":"#/components/schemas/PublishApprovedItem"},"type":"array","title":"Items"}},"type":"object","required":["updated","items"],"title":"PublishToggleApprovedOut"},"RuleAgentEscalation":{"properties":{"required":{"type":"boolean","title":"Required","default":false},"reason":{"type":"string","title":"Reason","default":""},"escalationId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Escalationid"},"notified":{"type":"boolean","title":"Notified","default":false}},"type":"object","title":"RuleAgentEscalation"},"RuleAgentReport":{"properties":{"status":{"type":"string","enum":["passed","failed","inconclusive"],"title":"Status"},"summary":{"type":"string","title":"Summary"},"findings":{"items":{"$ref":"#/components/schemas/RuleAgentReportFinding"},"type":"array","title":"Findings"},"recommendations":{"items":{"type":"string"},"type":"array","title":"Recommendations"}},"type":"object","required":["status","summary"],"title":"RuleAgentReport"},"RuleAgentReportFinding":{"properties":{"condition":{"type":"string","title":"Condition"},"expected":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expected"},"actual":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actual"},"passed":{"type":"boolean","title":"Passed"}},"type":"object","required":["condition","passed"],"title":"RuleAgentReportFinding"},"RuleAgentToolCallOut":{"properties":{"tool":{"type":"string","title":"Tool"},"arguments":{"type":"object","title":"Arguments","default":{}},"ok":{"type":"boolean","title":"Ok","default":true},"result":{"anyOf":[{},{"type":"null"}],"title":"Result"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["tool"],"title":"RuleAgentToolCallOut"},"RuleApproveOut":{"properties":{"message":{"type":"string","title":"Message","examples":["Rule approved and version created"]},"ruleId":{"type":"string","format":"uuid","title":"Ruleid"},"ruleVersionId":{"type":"string","format":"uuid","title":"Ruleversionid","description":"The RuleDefinitionVersion published."},"version":{"type":"integer","title":"Version"},"valueVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Valueversionid","description":"The first RuleValueDefinitionVersion, when this approval created it."},"retiredVersions":{"items":{"type":"integer"},"type":"array","title":"Retiredversions","description":"Versions retired by this one."},"approved":{"type":"integer","title":"Approved","default":1}},"additionalProperties":true,"type":"object","required":["message","ruleId","ruleVersionId","version"],"title":"RuleApproveOut"},"RuleCacheClearOut":{"properties":{"message":{"type":"string","title":"Message","description":"Status message"},"ruleId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruleid","description":"Cleared rule ID if specific, else null"}},"additionalProperties":true,"type":"object","required":["message"],"title":"RuleCacheClearOut"},"RuleCacheStatsOut":{"properties":{"cachedAstCount":{"type":"integer","title":"Cachedastcount","description":"Number of compiled AST trees in memory"},"cachedRulesCount":{"type":"integer","title":"Cachedrulescount","description":"Number of published rules cached"},"ttlSeconds":{"type":"number","title":"Ttlseconds","description":"Cache TTL in seconds"},"hits":{"type":"integer","title":"Hits","description":"Rule cache hits"},"misses":{"type":"integer","title":"Misses","description":"Rule cache misses"},"astHits":{"type":"integer","title":"Asthits","description":"Compiled AST cache hits"},"astMisses":{"type":"integer","title":"Astmisses","description":"Compiled AST cache misses"}},"additionalProperties":true,"type":"object","required":["cachedAstCount","cachedRulesCount","ttlSeconds","hits","misses","astHits","astMisses"],"title":"RuleCacheStatsOut"},"RuleComposeGetOut":{"properties":{"Rule_Id":{"type":"string","format":"uuid","title":"Rule Id"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype"},"Body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"RawRuleJson":{"anyOf":[{},{"type":"null"}],"title":"Rawrulejson"},"ScriptBody":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Scriptbody"},"AiRuleExpression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Airuleexpression"},"pricing":{"items":{"$ref":"#/components/schemas/PricingItem"},"type":"array","title":"Pricing"}},"type":"object","required":["Rule_Id","pricing"],"title":"RuleComposeGetOut"},"RuleComposeIn":{"properties":{"script":{"anyOf":[{"$ref":"#/components/schemas/ScriptPatch"},{"type":"null"}]},"pricing":{"anyOf":[{"items":{"$ref":"#/components/schemas/PricingIn"},"type":"array"},{"type":"null"}],"title":"Pricing"},"replace_pricing":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Replace Pricing"},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion"}},"type":"object","title":"RuleComposeIn"},"RuleComposeResult":{"properties":{"ruleId":{"type":"string","format":"uuid","title":"Ruleid"},"inserted_pricing":{"type":"integer","title":"Inserted Pricing"},"pricing":{"anyOf":[{"items":{"$ref":"#/components/schemas/PricingItem"},"type":"array"},{"type":"null"}],"title":"Pricing"},"script":{"anyOf":[{"$ref":"#/components/schemas/ScriptAfter"},{"type":"null"}]}},"type":"object","required":["ruleId","inserted_pricing"],"title":"RuleComposeResult"},"RuleConditionResult":{"properties":{"left":{"type":"string","title":"Left"},"op":{"type":"string","title":"Op"},"right":{"title":"Right"},"result":{"type":"boolean","title":"Result"},"left_value":{"title":"Left Value"},"right_value":{"title":"Right Value"}},"type":"object","required":["left","op","result"],"title":"RuleConditionResult","description":"One comparison of the rule's IF part, evaluated against the test data."},"RuleConflictReportOut":{"properties":{"targetId":{"type":"string","format":"uuid","title":"Targetid"},"totalRulesChecked":{"type":"integer","title":"Totalruleschecked"},"hasConflicts":{"type":"boolean","title":"Hasconflicts"},"conflictsCount":{"type":"integer","title":"Conflictscount"},"conflicts":{"items":{"$ref":"#/components/schemas/ConflictItem"},"type":"array","title":"Conflicts"}},"type":"object","required":["targetId","totalRulesChecked","hasConflicts","conflictsCount"],"title":"RuleConflictReportOut"},"RuleCreate":{"properties":{"ExistingRuleID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Existingruleid"},"Name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name"},"Body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"AiRuleExpression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Airuleexpression"},"ScriptBody":{"anyOf":[{"items":{"$ref":"#/components/schemas/ScriptsDataIn"},"type":"array"},{"type":"null"}],"title":"Scriptbody"},"PricingScriptBody":{"anyOf":[{"items":{"$ref":"#/components/schemas/PricingIn"},"type":"array"},{"type":"null"}],"title":"Pricingscriptbody"},"ApplicationID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid"},"Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"Status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status"},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved"},"IsEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isenabled"},"StatusDescription":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Statusdescription"},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion"}},"type":"object","title":"RuleCreate"},"RuleDependenciesOut":{"properties":{"ruleId":{"type":"string","format":"uuid","title":"Ruleid"},"ruleName":{"type":"string","title":"Rulename"},"ruleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype"},"isApproved":{"type":"boolean","title":"Isapproved","default":false},"totalOffers":{"type":"integer","title":"Totaloffers","default":0},"offers":{"items":{"$ref":"#/components/schemas/OfferDependencyItem"},"type":"array","title":"Offers"},"totalPartners":{"type":"integer","title":"Totalpartners","default":0},"partners":{"items":{"$ref":"#/components/schemas/PartnerDependencyItem"},"type":"array","title":"Partners"},"versionsCount":{"type":"integer","title":"Versionscount","default":0},"valueVersionsCount":{"type":"integer","title":"Valueversionscount","default":0},"activeValueVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activevalueversion"},"canSafelyDeleteOrArchive":{"type":"boolean","title":"Cansafelydeleteorarchive","default":true},"blockingReasons":{"items":{"type":"string"},"type":"array","title":"Blockingreasons"}},"type":"object","required":["ruleId","ruleName"],"title":"RuleDependenciesOut"},"RuleDraftVersionIn":{"properties":{"Notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","title":"RuleDraftVersionIn"},"RuleEditFromPromptIn":{"properties":{"prompt":{"type":"string","title":"Prompt"},"dry_run":{"type":"boolean","title":"Dry Run","default":false}},"type":"object","required":["prompt"],"title":"RuleEditFromPromptIn"},"RuleEditFromPromptOut":{"properties":{"Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"RuleDefinition.Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id"},"Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"RuleDefinition.Name"},"RawRule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawrule","description":"RuleDefinition.RawRule"},"RawRuleAi":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawruleai","description":"RuleDefinition.RawRuleAi"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"RuleDefinition.RuleType"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"RuleDefinition.Description"},"id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"Legacy alias for Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Legacy alias for Name"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body","description":"Legacy alias for RawRule"},"previous_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous Name"},"previous_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous Body"},"changes":{"items":{"type":"string"},"type":"array","title":"Changes","default":[]},"dry_run":{"type":"boolean","title":"Dry Run","default":false},"persisted":{"type":"boolean","title":"Persisted","default":false},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"raw_rule_json":{"anyOf":[{},{"type":"null"}],"title":"Raw Rule Json"},"action":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action"},"rules":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Rules"},"tool_calls":{"items":{"$ref":"#/components/schemas/RuleAgentToolCallOut"},"type":"array","title":"Tool Calls","default":[]},"ExecutionTimeSec":{"type":"number","title":"Executiontimesec","description":"Seconds taken to finish after the request input is received","default":0.0}},"type":"object","title":"RuleEditFromPromptOut"},"RuleEvaluateBatchRequest":{"properties":{"context":{"$ref":"#/components/schemas/RuleEvaluationContext"},"rules":{"items":{"$ref":"#/components/schemas/BatchRuleItem"},"type":"array","title":"Rules"}},"type":"object","required":["context","rules"],"title":"RuleEvaluateBatchRequest"},"RuleEvaluateBatchResponse":{"properties":{"outcomes":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Outcomes"},"results":{"items":{"$ref":"#/components/schemas/BatchRuleResult"},"type":"array","title":"Results"}},"type":"object","required":["outcomes","results"],"title":"RuleEvaluateBatchResponse"},"RuleEvaluateRequest":{"properties":{"context":{"$ref":"#/components/schemas/RuleEvaluationContext"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"Optional RuleType filter: Condition, Pricing, Calculation, Validation or Decision"},"RuleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid","description":"RuleDefinitionVersion to run. Default: the published version, or the current text if never published."},"RuleValueDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rulevaluedefinitionversionid","description":"Optional RuleValueDefinitionVersion to run for dynamic right-hand value simulation."},"usePublishedValues":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Usepublishedvalues","description":"When true, evaluates with active published values from RuleValueDefinitionVersion.","default":false},"ruleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"Legacy alias for RuleType"},"versionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Versionid","description":"Legacy alias for RuleDefinitionVersionId"},"valueVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Valueversionid","description":"Legacy alias for RuleValueDefinitionVersionId"}},"type":"object","required":["context"],"title":"RuleEvaluateRequest"},"RuleEvaluateResponse":{"properties":{"Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"RuleDefinition.Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id"},"RuleName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rulename","description":"RuleDefinition.Name"},"Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"RuleDefinition.Name"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"RuleDefinition.RuleType"},"RuleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid","description":"RuleDefinitionVersion.Id"},"RuleValueDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rulevaluedefinitionversionid","description":"RuleValueDefinitionVersion.Id"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version","description":"Version number that ran"},"ValueVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Valueversion","description":"Value version number that ran"},"ruleId":{"type":"string","title":"Ruleid"},"ruleName":{"type":"string","title":"Rulename"},"ruleVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ruleversion"},"source":{"type":"string","enum":["version","published","current","value_version","published_values","offer_values"],"title":"Source","default":"current"},"passed":{"type":"boolean","title":"Passed"},"reason":{"type":"string","title":"Reason"},"matchedConditions":{"items":{"type":"string"},"type":"array","title":"Matchedconditions"},"failedConditions":{"items":{"type":"string"},"type":"array","title":"Failedconditions"}},"type":"object","required":["ruleId","ruleName","passed","reason"],"title":"RuleEvaluateResponse"},"RuleEvaluationContext":{"properties":{"formValues":{"additionalProperties":{"type":"object"},"type":"object","title":"Formvalues"},"flatValues":{"type":"object","title":"Flatvalues"},"workflow":{"anyOf":[{"$ref":"#/components/schemas/WorkflowContext"},{"type":"null"}]}},"type":"object","title":"RuleEvaluationContext"},"RuleExplainOut":{"properties":{"ruleId":{"type":"string","format":"uuid","title":"Ruleid"},"ruleName":{"type":"string","title":"Rulename"},"ruleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype"},"explanation":{"type":"string","title":"Explanation"},"conditionSummaries":{"items":{"type":"string"},"type":"array","title":"Conditionsummaries"},"actionSummaries":{"items":{"type":"string"},"type":"array","title":"Actionsummaries"},"pricingAdjustmentSummaries":{"items":{"type":"string"},"type":"array","title":"Pricingadjustmentsummaries"}},"type":"object","required":["ruleId","ruleName","explanation"],"title":"RuleExplainOut"},"RuleLookupItem":{"properties":{"ID":{"type":"string","format":"uuid","title":"Id"},"Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type","description":"RuleType"},"ApplicationID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid"},"Status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status","description":"IsActive, 1 / 0"},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"IsApproved, 1 / 0"}},"additionalProperties":true,"type":"object","required":["ID"],"title":"RuleLookupItem"},"RuleOut":{"properties":{"IsCheckedOut":{"type":"boolean","title":"Ischeckedout","description":"The latest version is a draft checked out (and not expired)","default":false},"CheckedOutByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Checkedoutbyuserid","description":"UserAccount.Id holding the check-out"},"CheckedOutByName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkedoutbyname"},"CheckoutExpiresAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checkoutexpiresatutc","description":"The check-out lapses after this time"},"CheckoutNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkoutnotes"},"CheckedInAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checkedinatutc"},"CheckinNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkinnotes"},"DraftVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Draftversion","description":"Number of the draft version, when there is one"},"ExistingRuleID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Existingruleid"},"Name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name"},"Body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"AiRuleExpression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Airuleexpression"},"ScriptBody":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Scriptbody"},"PricingScriptBody":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Pricingscriptbody"},"ApplicationID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid"},"Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"Status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status"},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved"},"IsEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isenabled"},"StatusDescription":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Statusdescription"},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion"},"ID":{"type":"string","format":"uuid","title":"Id"},"ScriptBodyFormat":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scriptbodyformat"},"PricingScriptBodyFormat":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingscriptbodyformat"},"ScriptBodyRaw":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scriptbodyraw"},"PricingScriptBodyRaw":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingscriptbodyraw"},"RuleTypeName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletypename"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version"},"ValuesVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Valuesversion"},"RawRuleJson":{"anyOf":[{},{"type":"null"}],"title":"Rawrulejson"},"CreatedDate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Createddate"},"ModifiedDate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modifieddate"},"CreatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Createdbyuserid"},"UpdatedByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Updatedbyuserid"}},"type":"object","required":["ID"],"title":"RuleOut"},"RulePlan":{"properties":{"conditions":{"$ref":"#/components/schemas/ConditionsBlock"},"actions":{"items":{"$ref":"#/components/schemas/ActionItem"},"type":"array","title":"Actions"},"placeholders":{"anyOf":[{"$ref":"#/components/schemas/PlaceholderSets"},{"type":"null"}]}},"type":"object","required":["conditions","actions"],"title":"RulePlan"},"RuleRecord":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id","description":"RuleDefinition.Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id"},"Name":{"type":"string","title":"Name","description":"RuleDefinition.Name"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"RuleDefinition.RuleType"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"RuleDefinition.Description"},"RawRule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawrule","description":"RuleDefinition.RawRule"},"RawRuleAi":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawruleai","description":"RuleDefinition.RawRuleAi"},"ScriptBody":{"anyOf":[{},{"type":"null"}],"title":"Scriptbody","description":"Condition rows JSON array"},"PricingScriptBody":{"anyOf":[{},{"type":"null"}],"title":"Pricingscriptbody","description":"Action / pricing rows JSON array"},"IsActive":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isactive","description":"RuleDefinition.IsActive"},"IsEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isenabled","description":"RuleDefinition.IsEnabled"},"IsApproved":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isapproved","description":"RuleDefinition.IsApproved"},"CreatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Createdatutc","description":"RuleDefinition.CreatedAtUtc"},"UpdatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updatedatutc","description":"RuleDefinition.UpdatedAtUtc"},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion","description":"RowVersion concurrency token"},"id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"Legacy alias for Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Legacy alias for Name"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body","description":"Legacy alias for RawRule"},"rule_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rule Type","description":"Legacy alias for RuleType"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Legacy alias for Description"},"script_body":{"anyOf":[{},{"type":"null"}],"title":"Script Body","description":"Legacy alias for ScriptBody"},"pricing_script_body":{"anyOf":[{},{"type":"null"}],"title":"Pricing Script Body","description":"Legacy alias for PricingScriptBody"},"ai_rule_expression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Rule Expression","description":"Legacy alias for RawRuleAi"},"approved":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Approved","description":"Legacy alias for IsApproved"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status","description":"Legacy alias for IsActive / UpdatedNotes"},"created_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created Date","description":"Legacy alias for CreatedAtUtc"}},"type":"object","required":["Id","Name"],"title":"RuleRecord"},"RuleRollbackOut":{"properties":{"ruleId":{"type":"string","format":"uuid","title":"Ruleid"},"ruleName":{"type":"string","title":"Rulename"},"target":{"type":"string","title":"Target","default":"definition"},"rolledBackToVersion":{"type":"integer","title":"Rolledbacktoversion"},"currentVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Currentversion"},"message":{"type":"string","title":"Message"}},"type":"object","required":["ruleId","ruleName","rolledBackToVersion","message"],"title":"RuleRollbackOut"},"RuleSaveIn":{"properties":{"Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"RuleDefinition.Id to update (or None for new rule)"},"Name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name","description":"RuleDefinition.Name"},"RawRule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawrule","description":"Rule syntax text (dbo.RuleDefinition.RawRule)"},"RawRuleAi":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawruleai","description":"AI natural-language rendering (dbo.RuleDefinition.RawRuleAi)"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"RuleDefinition.RuleType: Condition, Pricing, Calculation, Validation, Decision"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Rule description"},"IsActive":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isactive","description":"RuleDefinition.IsActive"},"IsEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isenabled","description":"RuleDefinition.IsEnabled"},"IsApproved":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isapproved","description":"RuleDefinition.IsApproved"},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion","description":"RowVersion concurrency token"},"id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"Legacy alias for Id"},"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name","description":"Legacy alias for Name"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body","description":"Legacy alias for RawRule"},"Body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body","description":"Alias for RawRule"},"ai_rule_expression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Rule Expression","description":"Legacy alias for RawRuleAi"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Legacy alias for Description"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type","description":"Legacy alias for RuleType"},"status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status","description":"Legacy alias for IsActive (1/0)"},"approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy alias for IsApproved (1/0)"},"row_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Row Version","description":"Legacy alias for RowVersion"}},"type":"object","title":"RuleSaveIn"},"RuleSaveOut":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id","description":"RuleDefinition.Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id"},"Name":{"type":"string","title":"Name","description":"RuleDefinition.Name"},"RuleType":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruletype","description":"RuleDefinition.RuleType"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"RuleDefinition.Description"},"RawRule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawrule","description":"RuleDefinition.RawRule"},"RawRuleAi":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawruleai","description":"RuleDefinition.RawRuleAi"},"IsActive":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isactive","description":"RuleDefinition.IsActive"},"IsEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isenabled","description":"RuleDefinition.IsEnabled"},"IsApproved":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isapproved","description":"RuleDefinition.IsApproved"},"CreatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Createdatutc","description":"RuleDefinition.CreatedAtUtc"},"UpdatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updatedatutc","description":"RuleDefinition.UpdatedAtUtc"},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion","description":"RowVersion concurrency token"},"RawRuleJson":{"anyOf":[{},{"type":"null"}],"title":"Rawrulejson","description":"Visual condition parse tree"},"id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"Legacy alias for Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Legacy alias for Name"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body","description":"Legacy alias for RawRule"},"approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy alias for IsApproved (1/0)"},"created_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created Date","description":"Legacy alias for CreatedAtUtc"},"raw_rule_json":{"anyOf":[{},{"type":"null"}],"title":"Raw Rule Json","description":"Legacy alias for RawRuleJson"}},"type":"object","required":["Id","Name"],"title":"RuleSaveOut"},"RuleTestCase":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"expectedOutcome":{"type":"boolean","title":"Expectedoutcome"},"context":{"$ref":"#/components/schemas/RuleEvaluationContext"}},"type":"object","required":["name","description","expectedOutcome","context"],"title":"RuleTestCase"},"RuleTestCasesOut":{"properties":{"ruleId":{"type":"string","format":"uuid","title":"Ruleid"},"ruleName":{"type":"string","title":"Rulename"},"testCases":{"items":{"$ref":"#/components/schemas/RuleTestCase"},"type":"array","title":"Testcases"}},"type":"object","required":["ruleId","ruleName"],"title":"RuleTestCasesOut"},"RuleTestRequest":{"properties":{"prompt":{"type":"string","title":"Prompt"},"test_data":{"type":"object","title":"Test Data"}},"type":"object","required":["prompt"],"title":"RuleTestRequest"},"RuleTestResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"condition_result":{"type":"boolean","title":"Condition Result","default":false},"conditions":{"items":{"$ref":"#/components/schemas/RuleConditionResult"},"type":"array","title":"Conditions"},"updated_data":{"type":"object","title":"Updated Data"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"}},"type":"object","required":["success"],"title":"RuleTestResponse"},"RuleTypeItem":{"properties":{"code":{"type":"string","title":"Code","examples":["Pricing"]},"name":{"type":"string","title":"Name","examples":["Pricing"]}},"additionalProperties":true,"type":"object","required":["code","name"],"title":"RuleTypeItem"},"RuleTypesOut":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RuleTypeItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"additionalProperties":true,"type":"object","required":["items","total"],"title":"RuleTypesOut"},"RuleUpdate":{"properties":{"ExistingRuleID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Existingruleid"},"Name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name"},"Body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"AiRuleExpression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Airuleexpression"},"ScriptBody":{"anyOf":[{"items":{"$ref":"#/components/schemas/ScriptsDataIn"},"type":"array"},{"type":"null"}],"title":"Scriptbody"},"PricingScriptBody":{"anyOf":[{"items":{"$ref":"#/components/schemas/PricingIn"},"type":"array"},{"type":"null"}],"title":"Pricingscriptbody"},"ApplicationID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid"},"Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"Status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status"},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved"},"IsEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isenabled"},"StatusDescription":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Statusdescription"},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion"}},"type":"object","title":"RuleUpdate"},"RuleUsageOut":{"properties":{"ruleId":{"type":"string","format":"uuid","title":"Ruleid"},"ruleVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruleversionid"},"inUse":{"type":"boolean","title":"Inuse"},"steps":{"items":{"$ref":"#/components/schemas/UsageStep"},"type":"array","title":"Steps","description":"Checklist steps (ItemRuleDefinition)."},"routes":{"items":{"$ref":"#/components/schemas/UsageRoute"},"type":"array","title":"Routes","description":"Step routes (ChecklistItemRoute)."},"forms":{"items":{"$ref":"#/components/schemas/UsageForm"},"type":"array","title":"Forms","description":"Step forms (ItemFormDefinition)."},"runs":{"type":"integer","title":"Runs","description":"Workflow runs that evaluated the rule (WorkItemRule).","default":0}},"additionalProperties":true,"type":"object","required":["ruleId","inUse"],"title":"RuleUsageOut"},"RuleValueEditIn":{"properties":{"ScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scriptbody","description":"Updated condition values stored in ScriptBody."},"PricingScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingscriptbody","description":"Updated pricing values stored in PricingScriptBody."},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Updated version description."},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"Optional guard: version must belong to this rule."},"Data":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data","description":"Legacy alias for ScriptBody / PricingScriptBody."},"Remarks":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Remarks","description":"Legacy alias for Description."},"Rule_Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rule Id","description":"Legacy alias for RuleDefinitionId."}},"type":"object","title":"RuleValueEditIn","description":"Request body to correct an existing value version in place."},"RuleValueItem":{"properties":{"IsCheckedOut":{"type":"boolean","title":"Ischeckedout","description":"The latest version is a draft checked out (and not expired)","default":false},"CheckedOutByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Checkedoutbyuserid","description":"UserAccount.Id holding the check-out"},"CheckedOutByName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkedoutbyname"},"CheckoutExpiresAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checkoutexpiresatutc","description":"The check-out lapses after this time"},"CheckoutNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkoutnotes"},"CheckedInAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checkedinatutc"},"CheckinNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkinnotes"},"DraftVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Draftversion","description":"Number of the draft version, when there is one"},"Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"RuleValueDefinitionVersion.Id"},"RuleDefinitionId":{"type":"string","format":"uuid","title":"Ruledefinitionid","description":"RuleDefinition.Id"},"RuleValueDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rulevaluedefinitionid","description":"RuleValueDefinition.Id"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version","description":"Latest value version number."},"LiveVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Liveversion","description":"Highest published value version (in the rules list); None while only base values exist."},"ScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scriptbody","description":"Condition values expression (ScriptBody)."},"PricingScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingscriptbody","description":"Pricing / offer values expression (PricingScriptBody)."},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Version description or remarks."},"IsPublished":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ispublished","description":"Whether the version is published."},"IsEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isenabled","description":"Whether the version is enabled."},"ApplicationId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid","description":"Owning ApplicationId."},"CreatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Createdatutc","description":"Timestamp when version was created."},"Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"RuleDefinition.Name"},"Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type","description":"RuleDefinition.RuleType"},"RawRule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawrule","description":"RuleDefinition.RawRule"},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion","description":"RowVersion concurrency token."},"RuleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid","description":"The approved rule version these values belong to (RuleValueDefinition.RuleDefinitionVersionId)."},"RuleVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ruleversion","description":"Number of that rule version; value versions count from 1 per rule version."},"IsLiveValues":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Islivevalues","description":"Whether these are the live rule version's values."},"BaseScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Basescriptbody","description":"The rule version's logic the values start from (RuleValueDefinition.ScriptBody)."},"Rule_Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rule Id","description":"Legacy alias for RuleDefinitionId."},"ValueVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Valueversionid","description":"Legacy alias for Id."},"ObjectVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Objectversionid","description":"Legacy alias for Id."},"Data":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data","description":"Legacy alias for ScriptBody."},"PricingData":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingdata","description":"Legacy alias for PricingScriptBody."},"Remarks":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Remarks","description":"Legacy alias for Description."},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy alias for IsPublished (1 / 0)."},"RuleApproved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ruleapproved","description":"Rule definition approval status (1 / 0)."},"DateTimeChanged":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Datetimechanged","description":"Legacy alias for CreatedAtUtc."},"raw_rule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Rule","description":"Legacy alias for RawRule."},"rule_with_value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rule With Value","description":"Legacy alias for ScriptBody."},"pricing_with_value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricing With Value","description":"Legacy alias for PricingScriptBody."},"RawRuleJson":{"anyOf":[{},{"type":"null"}],"title":"Rawrulejson","description":"The values as the builder's condition tree (in a rule's value history)."}},"type":"object","required":["RuleDefinitionId"],"title":"RuleValueItem","description":"A rule with its latest right-hand value version from dbo.RuleValueDefinitionVersion."},"RuleValueModifyIn":{"properties":{"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id for the values."},"ScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scriptbody","description":"Rule values stored in ScriptBody."},"PricingScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingscriptbody","description":"Pricing / offer values stored in PricingScriptBody."},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Version description or remarks."},"Rule_Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rule Id","description":"Legacy alias for RuleDefinitionId."},"Data":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data","description":"Legacy alias for ScriptBody (or PricingScriptBody)."},"Remarks":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Remarks","description":"Legacy alias for Description."}},"type":"object","title":"RuleValueModifyIn","description":"Request body to set a rule's values and create a new RuleValueDefinitionVersion."},"RuleValueRowOut":{"properties":{"IsCheckedOut":{"type":"boolean","title":"Ischeckedout","description":"The latest version is a draft checked out (and not expired)","default":false},"CheckedOutByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Checkedoutbyuserid","description":"UserAccount.Id holding the check-out"},"CheckedOutByName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkedoutbyname"},"CheckoutExpiresAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checkoutexpiresatutc","description":"The check-out lapses after this time"},"CheckoutNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkoutnotes"},"CheckedInAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checkedinatutc"},"CheckinNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkinnotes"},"DraftVersion":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Draftversion","description":"Number of the draft version, when there is one"},"Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"RuleValueDefinitionVersion.Id"},"RuleDefinitionId":{"type":"string","format":"uuid","title":"Ruledefinitionid","description":"RuleDefinition.Id"},"RuleValueDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rulevaluedefinitionid","description":"RuleValueDefinition.Id"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version","description":"Value version number."},"ScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scriptbody","description":"Condition values (ScriptBody)."},"PricingScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingscriptbody","description":"Pricing / offer values (PricingScriptBody)."},"Description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Description / remarks."},"IsPublished":{"type":"boolean","title":"Ispublished","description":"Whether the version is published.","default":false},"IsEnabled":{"type":"boolean","title":"Isenabled","description":"Whether the version is enabled.","default":true},"ApplicationId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Applicationid","description":"Application GUID."},"CreatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Createdatutc","description":"Timestamp when version was created."},"RowVersion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rowversion","description":"RowVersion concurrency token."},"Rule_Id":{"type":"string","format":"uuid","title":"Rule Id","description":"Legacy alias for RuleDefinitionId."},"Data":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data","description":"Legacy alias for ScriptBody."},"PricingData":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingdata","description":"Legacy alias for PricingScriptBody."},"Remarks":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Remarks","description":"Legacy alias for Description."},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy alias for IsPublished (1 / 0)."},"DateTimeChanged":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Datetimechanged","description":"Legacy alias for CreatedAtUtc."}},"type":"object","required":["RuleDefinitionId","Rule_Id"],"title":"RuleValueRowOut","description":"A single RuleValueDefinitionVersion row returned after creating or updating values."},"RuleValuesListOut":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RuleValueItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"pageSize":{"type":"integer","title":"Pagesize"}},"type":"object","required":["items","total","page","pageSize"],"title":"RuleValuesListOut"},"RuleVersionDiffOut":{"properties":{"ruleId":{"type":"string","format":"uuid","title":"Ruleid"},"ruleName":{"type":"string","title":"Rulename"},"target":{"type":"string","title":"Target","default":"definition"},"v1":{"type":"integer","title":"V1"},"v2":{"type":"integer","title":"V2"},"summary":{"type":"string","title":"Summary"},"textDiff":{"items":{"type":"string"},"type":"array","title":"Textdiff"},"conditionsDiff":{"$ref":"#/components/schemas/ConditionDiffBlock"},"pricingDiff":{"$ref":"#/components/schemas/PricingDiffBlock"}},"type":"object","required":["ruleId","ruleName","v1","v2","summary"],"title":"RuleVersionDiffOut"},"RuleVersionItem":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id"},"Rule_Id":{"type":"string","format":"uuid","title":"Rule Id"},"Version":{"type":"integer","title":"Version"},"RawRule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawrule"},"RawRuleAi":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rawruleai"},"ScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scriptbody"},"PricingScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingscriptbody"},"Notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved"},"LifecycleStatus":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lifecyclestatus"},"PublishedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Publishedatutc"},"CreatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Createdatutc"},"IsCheckedOut":{"type":"boolean","title":"Ischeckedout","default":false},"CheckedOutAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checkedoutatutc"},"CheckedOutByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Checkedoutbyuserid"},"CheckedOutByName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkedoutbyname"},"CheckoutNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkoutnotes"},"CheckoutExpiresAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checkoutexpiresatutc"},"CheckedInAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checkedinatutc"},"CheckedInByUserId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Checkedinbyuserid"},"CheckedInByName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkedinbyname"},"CheckinNotes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkinnotes"}},"type":"object","required":["Id","Rule_Id","Version"],"title":"RuleVersionItem"},"RuleVersionsListOut":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RuleVersionItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"pageSize":{"type":"integer","title":"Pagesize"}},"type":"object","required":["items","total","page","pageSize"],"title":"RuleVersionsListOut"},"RulesListOut":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RuleOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"pageSize":{"type":"integer","title":"Pagesize"}},"type":"object","required":["items","total","page","pageSize"],"title":"RulesListOut"},"SavedTestCaseIn":{"properties":{"Name":{"type":"string","maxLength":200,"minLength":1,"title":"Name","description":"Unique per rule (ignoring case)."},"TestData":{"type":"object","title":"Testdata","description":"{\"DataType\": {\"Attribute\": value}}"},"ExpectApplies":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Expectapplies","description":"Whether the rule should apply; null to only run it."}},"type":"object","required":["Name"],"title":"SavedTestCaseIn"},"SavedTestCaseOut":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id"},"Name":{"type":"string","title":"Name"},"TestData":{"type":"object","title":"Testdata"},"ExpectApplies":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Expectapplies"},"SortOrder":{"type":"integer","title":"Sortorder"},"UpdatedAtUtc":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updatedatutc"}},"type":"object","required":["Id","Name","TestData","SortOrder"],"title":"SavedTestCaseOut"},"SavedTestCasesIn":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SavedTestCaseIn"},"type":"array","maxItems":100,"title":"Items"}},"type":"object","title":"SavedTestCasesIn"},"SavedTestCasesOut":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SavedTestCaseOut"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"SavedTestCasesOut"},"ScriptAfter":{"properties":{"ID":{"type":"string","format":"uuid","title":"Id"},"Body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"RawRuleJson":{"anyOf":[{},{"type":"null"}],"title":"Rawrulejson"},"ScriptBody":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Scriptbody"},"AiRuleExpression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Airuleexpression"}},"type":"object","required":["ID"],"title":"ScriptAfter"},"ScriptPatch":{"properties":{"Body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"Type":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"null"}],"title":"Type"},"RawRuleJson":{"anyOf":[{},{"type":"null"}],"title":"Rawrulejson"},"ScriptBody":{"anyOf":[{"items":{"$ref":"#/components/schemas/ScriptsDataIn"},"type":"array"},{"type":"null"}],"title":"Scriptbody"},"AiRuleExpression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Airuleexpression"},"RuleExpression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ruleexpression"},"RuleExpressionJson":{"anyOf":[{},{"type":"null"}],"title":"Ruleexpressionjson"}},"type":"object","title":"ScriptPatch"},"ScriptsDataIn":{"properties":{"Condition_Optr":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Condition Optr"},"Start_Gp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Gp"},"Data_Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data Type"},"Attribute_Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attribute Name"},"Operator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Operator"},"Condition_Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Condition Name"},"Operand_Datatype":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Operand Datatype"},"Value_Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Type"},"Value":{"anyOf":[{},{"type":"null"}],"title":"Value"},"Price_Adjustment":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Price Adjustment"},"End_Gp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Gp"},"Connecter":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connecter"},"Adj_Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Adj Type"},"Attribute_Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attribute Type"},"Operand_Attribute":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Operand Attribute"}},"type":"object","title":"ScriptsDataIn","description":"One condition row of RuleDefinition.ScriptBody."},"StatusChangeOut":{"properties":{"message":{"type":"string","title":"Message","examples":["Approved Status Changed Successfully"]},"new_status":{"type":"integer","title":"New Status","description":"The status after the change: 1 approved, 0 not."},"id":{"type":"string","format":"uuid","title":"Id"}},"additionalProperties":true,"type":"object","required":["message","new_status","id"],"title":"StatusChangeOut"},"UsageForm":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id"},"Checklist":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checklist"},"ChecklistDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Checklistdefinitionid"},"Step":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Step"},"FormDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Formdefinitionid"},"RuleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version"}},"additionalProperties":true,"type":"object","required":["Id"],"title":"UsageForm"},"UsageGroup":{"properties":{"requests":{"type":"integer","title":"Requests","description":"Number of AI requests"},"inputTokens":{"type":"integer","title":"Inputtokens","description":"dbo.AiTokenUsage.InputTokenCount"},"outputTokens":{"type":"integer","title":"Outputtokens","description":"dbo.AiTokenUsage.OutputTokenCount"},"totalTokens":{"type":"integer","title":"Totaltokens","description":"Total tokens (InputTokenCount + OutputTokenCount)"},"durationMs":{"type":"integer","title":"Durationms","description":"dbo.AiTokenUsage.DurationMs"},"key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key","description":"The day, model, request type or service."}},"additionalProperties":true,"type":"object","required":["requests","inputTokens","outputTokens","totalTokens","durationMs"],"title":"UsageGroup"},"UsageMeasures":{"properties":{"requests":{"type":"integer","title":"Requests","description":"Number of AI requests"},"inputTokens":{"type":"integer","title":"Inputtokens","description":"dbo.AiTokenUsage.InputTokenCount"},"outputTokens":{"type":"integer","title":"Outputtokens","description":"dbo.AiTokenUsage.OutputTokenCount"},"totalTokens":{"type":"integer","title":"Totaltokens","description":"Total tokens (InputTokenCount + OutputTokenCount)"},"durationMs":{"type":"integer","title":"Durationms","description":"dbo.AiTokenUsage.DurationMs"}},"additionalProperties":true,"type":"object","required":["requests","inputTokens","outputTokens","totalTokens","durationMs"],"title":"UsageMeasures"},"UsageRoute":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id"},"Checklist":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checklist"},"ChecklistDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Checklistdefinitionid"},"FromStep":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fromstep"},"ToStep":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tostep"},"RuleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version"}},"additionalProperties":true,"type":"object","required":["Id"],"title":"UsageRoute"},"UsageStep":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id"},"Checklist":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checklist"},"ChecklistDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Checklistdefinitionid"},"Step":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Step"},"ItemDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Itemdefinitionid"},"RuleDefinitionVersionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionversionid"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version"},"IsEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Isenabled"}},"additionalProperties":true,"type":"object","required":["Id"],"title":"UsageStep"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ValueVersionLookupItem":{"properties":{"Id":{"type":"string","format":"uuid","title":"Id","description":"RuleValueDefinitionVersion.Id"},"RuleDefinitionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Ruledefinitionid","description":"RuleDefinition.Id"},"Name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"Type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"ScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scriptbody"},"PricingScriptBody":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingscriptbody"},"Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version"},"IsPublished":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ispublished"},"ID":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id","description":"Legacy alias for Id"},"Rule_Id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rule Id","description":"Legacy alias for RuleDefinitionId"},"Data":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data","description":"Legacy alias for ScriptBody"},"PricingData":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricingdata","description":"Legacy alias for PricingScriptBody"},"Approved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved","description":"Legacy IsPublished, 1 / 0"}},"additionalProperties":true,"type":"object","required":["Id"],"title":"ValueVersionLookupItem"},"WorkflowContext":{"properties":{"workflowId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflowid"},"sourceNodeId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sourcenodeid"},"targetNodeId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Targetnodeid"},"taskId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Taskid"}},"type":"object","title":"WorkflowContext"}},"securitySchemes":{"APIKeyHeader":{"type":"apiKey","description":"Internal service auth secret (the INTERNAL_SERVICE_SECRET setting).","in":"header","name":"X-Internal-Auth"},"AppId":{"type":"apiKey","description":"Application.Id GUID the request works in (required on /api data endpoints).","in":"header","name":"X-App-Id"}}},"tags":[{"name":"Rules","description":"Lifecycle management of business rules: authoring, versioning, drafting, approval, publishing, and retirement in `dbo.RuleDefinition`."},{"name":"Rule Functions","description":"Reusable rule functions and parameter schemas from `dbo.RuleFunction` and `dbo.RuleFunctionParameter`."},{"name":"Rule Values","description":"Dynamic right-hand value bindings, versioned value matrices, and publishing in `dbo.RuleValueDefinition` and `dbo.RuleValueDefinitionVersion`."},{"name":"Rules AI","description":"AI-powered natural language rule authoring, compilation, and prompt-driven rule edits."},{"name":"Rule Evaluation","description":"Runtime AST evaluation and batch rule condition execution against application payload contexts."},{"name":"AI Rule Agent","description":"Autonomous AI agent executing deep contextual evaluations and decision-making on rules."},{"name":"AI Usage","description":"AI token consumption per application from `dbo.AiTokenUsage`, by day, model, request type or service."},{"name":"Data Quality","description":"Integrity scans detecting duplicate rule bodies, orphaned value versions, and overlapping condition ranges."},{"name":"Transfer","description":"Bulk export of rules, functions, versions, and published configurations across CSV, JSON, Word (DOCX), and PDF formats."},{"name":"Utilities","description":"Service operational runtime metrics, process uptime, and diagnostics."},{"name":"Health","description":"Service readiness, database connectivity ping tests, and environment health checks."}]}