{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.rtemis.org/resampler/v1/schema.json",
  "title": "rtemis ResamplerConfig",
  "description": "Language-independent config for an rtemis resampler. Mirrors the `ResamplerConfig` object: a resampler type plus its type-specific settings. The same config drives rtemis (R), rtemis-py, and rtemislive to identical resamples.",
  "type": "object",
  "required": ["type"],
  "unevaluatedProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "const": "https://schema.rtemis.org/resampler/v1/schema.json",
      "description": "JSON Schema URI for this config instance."
    },
    "type": {
      "type": "string",
      "enum": ["KFold", "StratSub", "StratBoot", "Bootstrap", "LOOCV", "Custom"],
      "description": "Resampler type."
    },
    "n": {
      "type": ["integer", "null"],
      "minimum": 1,
      "description": "Number of resamples. null for LOOCV, where it is determined by the data."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "type": {
            "const": "KFold"
          }
        },
        "required": ["type"]
      },
      "then": {
        "$ref": "https://schema.rtemis.org/resampler/kfold/v1/schema.json",
        "required": ["n"]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "StratSub"
          }
        },
        "required": ["type"]
      },
      "then": {
        "$ref": "https://schema.rtemis.org/resampler/stratsub/v1/schema.json",
        "required": ["n"]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "StratBoot"
          }
        },
        "required": ["type"]
      },
      "then": {
        "$ref": "https://schema.rtemis.org/resampler/stratboot/v1/schema.json",
        "required": ["n"]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "Bootstrap"
          }
        },
        "required": ["type"]
      },
      "then": {
        "$ref": "https://schema.rtemis.org/resampler/bootstrap/v1/schema.json",
        "required": ["n"]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "LOOCV"
          }
        },
        "required": ["type"]
      },
      "then": {
        "$ref": "https://schema.rtemis.org/resampler/loocv/v1/schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "Custom"
          }
        },
        "required": ["type"]
      },
      "then": {
        "$ref": "https://schema.rtemis.org/resampler/custom/v1/schema.json",
        "required": ["n"]
      }
    }
  ]
}
