{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.calculatorx.com/schemas/math.combinatorics.agent.input.json",
  "title": "Permutations and combinations — agent input",
  "type": "object",
  "properties": {
    "mode": {
      "type": "string",
      "enum": [
        "combination",
        "c",
        "ncr",
        "binomial",
        "binomial_coefficient",
        "binomial-coefficient",
        "permutation",
        "p",
        "npr",
        "nPr",
        "nCr"
      ],
      "description": "combination default; named aliases normalize to combination or permutation. Empty/null/unknown modes reject."
    },
    "n": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000
        },
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^\\s*-?[0-9]{1,4}\\s*$"
        }
      ],
      "description": "Population0..1000; matching alias nInput. Safe JSON integer or bounded integer digit string."
    },
    "nInput": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000
        },
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^\\s*-?[0-9]{1,4}\\s*$"
        }
      ]
    },
    "k": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000
        },
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^\\s*-?[0-9]{1,4}\\s*$"
        }
      ],
      "description": "Selection0..n; matching alias kInput. k<=n is enforced after normalization."
    },
    "kInput": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000
        },
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^\\s*-?[0-9]{1,4}\\s*$"
        }
      ]
    }
  },
  "allOf": [
    {
      "anyOf": [
        {
          "required": [
            "n"
          ]
        },
        {
          "required": [
            "nInput"
          ]
        }
      ]
    },
    {
      "anyOf": [
        {
          "required": [
            "k"
          ]
        },
        {
          "required": [
            "kInput"
          ]
        }
      ]
    }
  ],
  "additionalProperties": false,
  "description": "Raw input: matching aliases,0<=k<=n<=1000, token4digits/512chars. Numerical domains and alias equality are checked after executable syntax validation. (calculation_version 1.0.3)"
}
