I want you to generate a JSON object that represents conditional logic for a form based on user input. The JSON should have the following structure: - "ConditionType": A string indicating the type of condition (e.g. "Hide", "Required" or "Validation"). - RootFormula: The calculation needed to do this condition. Used only when the condition can't be done using condition lines. - "Condition": An array of condition groups, where each group is an array of condition lines. - Within a group, e.g., `[cond1, cond2]`: All conditions must be true (AND logic). - Between groups, e.g., `[[cond1, cond2], [cond3]]`: Any one group being true satisfies the condition (OR logic). For example, `[[cond1, cond2], [cond3]]` means `(cond1 AND cond2) OR cond3`. - Each condition line is an object with: - "Field": The ID of the field (as a string) used to perform the comparison in the condition line, extracted from the user input format `[Field ID]`. - "ComparisonType": A string indicating the comparison, chosen from the supported options for the field’s type as listed below. - "Value": A string representing the value to compare against (optional for comparisons like "IsEmpty"), or an array of strings for the ContainsOption and NotContainsOption comparison. - "Formula": (Optional), used only when the value to compare agains require a calculation or the value of another field For "Validation" conditions, include an additional "ErrorMessage" property with a custom message. ### Condition Types These are the possible condition types: - "Hide": Hide the field when the condition is met. - "Required": Make the field required when the condition is met. - "Validation": Show an error message when the condition is met. ### Calculations ### - You can use arithmetical operations using the operators *+-/ Example: 1*[Field 10] - You can also do conditions inside these calculation using if && || example if([Field 10]>20 || [Field 50]<30) - If you need to exit a calculation without processing the rest of it you can use the return statement. Example if([Field 10]>20) return 50 - Some fields could have special functions in those cases the special function will be explaned in the field list. You can use special functions by adding a dot after the field example [Field 10].GetTotal {{SpecialCalculationsInstructions}} ### Comparison Types and Behavior These are the possible comparison types, with consistent behavior across all fields that support them: - "EqualTo": Field exactly matches the value (e.g., "Hello", "10", "true"). Supported by FieldTypes: "string", "number", "date", "composed". - "NotEqualTo": Field does not match the value (e.g., "Hello" != "World", 10 != 5). Supported by FieldTypes: "string", "number", "date" "composed". - "Contains": Field contains the value as a substring (e.g., "Hel" in "Hello"). Supported by FieldTypes: "string" "composed". - "NotContains": Field does not contains the value as a substring (e.g., "Hel" in "Hello"). Supported by FieldTypes: "string" "composed". - "ContainsOption": At least one option of a multiple_options field that was selected is part of a list of options. Put the array of options to compare the selected options against in the "Value" property. Supported by FieldTypes: "multiple_options". - "NotContainsOption": None of the selected options of a multiple_options field is part of a list of options. Put the array of options to compare the selected options against in the "Value" property. Supported by FieldTypes: "multiple_options". - "IsEmpty": Field has no value (e.g., empty string, null). Supported by FieldTypes: "string", "number", "multiple_options", "date", "composed". - "IsNotEmpty": Field has any value (e.g., non-empty string, any number). Supported by FieldTypes: "string", "number", "multiple_options", "date", "composed". - "GreaterThan": Field is greater than the value (e.g., 15 > 10). Supported by FieldTypes: "number", "date". - "LessThan": Field is less than the value (e.g., 5 < 10). Supported by FieldTypes: "number", "date". - "GreaterOrEqualThan": Field is greater than or equal to the value (e.g., 10 >= 10). Supported by FieldTypes: "number", "date". - "LessOrEqualThan": Field is less than or equal to the value (e.g., 10 <= 10). Supported by FieldTypes: "number", "date". - "IsChecked": Field is checked (e.g., a checkbox is checked). Supported by FieldTypes: "boolean". - "IsNotChecked": Field is not checked (e.g., a checkbox is not checked). Supported by FieldTypes: "boolean". ### Rules - The user input will always refer to fields in the format `[Field ID]`. Example: [Field 1] (the field ID is "1") or [Field 25] (the field ID is "25"). - Extract the field ID from the `[Field ID]` format and match it to a field in the field list to determine its FieldType. - Ensure the "ComparisonType" is supported by the field’s FieldType, as defined in the "Comparison Types and Behavior" section. - If the comparison type isn’t supported for the field’s FieldType, return {"ErrorReason": "Comparison type '[comparison]' is not supported for field '[field]'"}. - If the condition type isn't supported, return {"ErrorReason": "Condition type '[condition]' is not supported"}. - If the input cannot be interpreted (e.g., missing field, malformed format), return an object like {"ErrorReason": "Could not parse the input because..."} explaining the issue. - If the value of a comparison requires a calculation or the value of another. Leave the Value property empty and use the Formula instead put the operation in that proeprty. In the Formula refer to each field with is full definition e.g. "[Field 1]" or "[Field 2]" - If the condition can't be done using condition lines but can be done using a calculations leave the Conditions property empty and put the calculations in the RootFormula setting. Use list as the last resort, always prefer to do the condition using condition lines ### Examples 1. User input: "Hide a field when [Field 11] is equal to 10" Output: {"ConditionType":"Hide","Condition":[[{"Field":"11","ComparisonType":"EqualTo","Value":"10"}]]} 2. User input: "Hide the field when [Field 11] is greater than 10 and [Field 10] is empty" Output: {"ConditionType":"Hide","Condition":[[{"Field":"11","ComparisonType":"GreaterThan","Value":"10"},{"Field":"10","ComparisonType":"IsEmpty"}]]} 3. User input: "Make field required if ([Field 10] contains 'Hello' and [Field 12] is empty) or [Field 11] is empty" Output: {"ConditionType":"Required","Condition":[[{"Field":"10","ComparisonType":"Contains","Value":"Hello"},{"Field":"12","ComparisonType":"IsEmpty"}],[{"Field":"11","ComparisonType":"IsEmpty"}]]} 4. User input: "Throw the error 'The value needs to be greater than 10' when [Field 11] is less than or equal to 10" Output: {"ConditionType":"Validation","ErrorMessage":"The value needs to be greater than 10","Condition":[[{"Field":"11","ComparisonType":"LessOrEqualThan","Value":"10"}]]} 5. User input: "Hide the field when the option america of [Field 13] was selected" Output: {"ConditionType":"Hide","Condition":[[{"Field":"13","ComparisonType":"ContainsOption","Value":["america"]}]]} 6. User input: "Hide the field when the option europe of [Field 13] was not selected" Output: {"ConditionType":"Hide","Condition":[[{"Field":"13","ComparisonType":"NotContainsOption","Value":["europe"]}]]} 7. User input: "Hide the field when [Field 2] is equal to [Field 3]" Output: {"ConditionType":"Hide","Condition":[[{"Field":"2","ComparisonType":"EqualTo","Value":"","Formula":"[Field 3]"}]]} 8. User input: "Hide field [Field 10] when [Field 8] by [Field 9] is greather than 20" Output:{"ConditionType":"Hide","Condition":[],"RootFormula":"if([Field 8][Field 9]>20 return true)"} This is the field list you should use: {{fields}}