{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/rulebase/main/json-schema/rulebase-scorecard-form-params-schema.json",
  "title": "ScorecardFormParams",
  "x-generated": "2026-10-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rulebase-openapi.json#/components/schemas/ScorecardFormParams",
  "type": "object",
  "properties": {
    "name": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "two_level": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "is_primary": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "status": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "draft",
        "published"
      ]
    },
    "lock_version": {
      "type": [
        "integer",
        "null"
      ]
    },
    "group_ids": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "conditions": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "condition_type": {
            "type": "string"
          },
          "value": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "condition_type"
        ]
      }
    },
    "scorecard_cap_rules": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "criterion_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "cap_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string"
              },
              {
                "nullable": true
              }
            ]
          },
          "position": {
            "type": [
              "integer",
              "null"
            ]
          },
          "result_score_types": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "_destroy": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      }
    },
    "scorecard_criteria": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "instructions": {
            "type": [
              "string",
              "null"
            ]
          },
          "position": {
            "type": [
              "integer",
              "null"
            ]
          },
          "max_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string"
              },
              {
                "nullable": true
              }
            ]
          },
          "ai_evaluations_enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "requires_knowledge_base_context": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "knowledge_base_document_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "score_options": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "label": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "nullable": true
                    }
                  ]
                },
                "type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "justification_options": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "content": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "_destroy": {
                        "type": [
                          "boolean",
                          "null"
                        ]
                      }
                    }
                  }
                },
                "_destroy": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                }
              }
            }
          },
          "checks": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "instructions": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "position": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "justification_options": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "content": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "score_option_id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "type": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "criterion_id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "values": {
                        "type": [
                          "array",
                          "null"
                        ],
                        "items": {
                          "type": "string"
                        }
                      },
                      "_destroy": {
                        "type": [
                          "boolean",
                          "null"
                        ]
                      }
                    }
                  }
                },
                "conditions": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string"
                      },
                      "value": {
                        "type": [
                          "array",
                          "null"
                        ],
                        "items": {
                          "type": "string"
                        }
                      },
                      "_destroy": {
                        "type": [
                          "boolean",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "field"
                    ]
                  }
                },
                "_destroy": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                }
              }
            }
          },
          "_destroy": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "children": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "instructions": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "position": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "max_score": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "nullable": true
                    }
                  ]
                },
                "ai_evaluations_enabled": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "requires_knowledge_base_context": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "knowledge_base_document_ids": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  }
                },
                "score_options": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "label": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "value": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string"
                          },
                          {
                            "nullable": true
                          }
                        ]
                      },
                      "type": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "justification_options": {
                        "type": [
                          "array",
                          "null"
                        ],
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "content": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "_destroy": {
                              "type": [
                                "boolean",
                                "null"
                              ]
                            }
                          }
                        }
                      },
                      "_destroy": {
                        "type": [
                          "boolean",
                          "null"
                        ]
                      }
                    }
                  }
                },
                "checks": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "instructions": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "position": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "justification_options": {
                        "type": [
                          "array",
                          "null"
                        ],
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "content": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "score_option_id": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "type": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "criterion_id": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "values": {
                              "type": [
                                "array",
                                "null"
                              ],
                              "items": {
                                "type": "string"
                              }
                            },
                            "_destroy": {
                              "type": [
                                "boolean",
                                "null"
                              ]
                            }
                          }
                        }
                      },
                      "conditions": {
                        "type": [
                          "array",
                          "null"
                        ],
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string"
                            },
                            "value": {
                              "type": [
                                "array",
                                "null"
                              ],
                              "items": {
                                "type": "string"
                              }
                            },
                            "_destroy": {
                              "type": [
                                "boolean",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "field"
                          ]
                        }
                      },
                      "_destroy": {
                        "type": [
                          "boolean",
                          "null"
                        ]
                      }
                    }
                  }
                },
                "_destroy": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}