{
  "type": "object",
  "properties": {
    "algorithm": {
      "type": "string",
      "enum": [
        "random",
        "grid",
        "bayesian",
        "hyperband",
        "cma-es",
        "sobol"
      ]
    },
    "baselineMetrics": {
      "type": "object",
      "additionalProperties": {
        "type": "number"
      },
      "propertyNames": {
        "minLength": 1,
        "maxLength": 128,
        "pattern": "^[a-zA-Z0-9._-]+$"
      }
    },
    "commandTemplate": {
      "type": "string",
      "maxLength": 8000
    },
    "dockerImage": {
      "type": "object",
      "properties": {
        "digest": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$"
        },
        "image": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        },
        "pullSecretName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        },
        "registry": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        },
        "tag": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "image",
        "registry",
        "tag"
      ],
      "additionalProperties": false
    },
    "fixedArgs": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 1024
      },
      "maxItems": 64,
      "default": []
    },
    "machineSizeId": {
      "type": "string",
      "enum": [
        "nano",
        "small",
        "medium",
        "large",
        "xl"
      ],
      "default": "nano"
    },
    "maxFailedTrialCount": {
      "type": "integer",
      "minimum": 1,
      "default": 3
    },
    "maxRuntimeSecondsPerTrial": {
      "type": "integer",
      "minimum": 1,
      "default": 60
    },
    "maxTrialCount": {
      "type": "integer",
      "minimum": 1,
      "default": 10
    },
    "objectives": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "conditions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "metric": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128,
                  "pattern": "^[a-zA-Z0-9._-]+$"
                },
                "op": {
                  "type": "string",
                  "enum": [
                    ">=",
                    "<="
                  ]
                },
                "value": {
                  "type": "number"
                }
              },
              "required": [
                "metric",
                "op",
                "value"
              ],
              "additionalProperties": false
            },
            "minItems": 1
          },
          "goal": {
            "type": "number"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9._-]+$"
          },
          "type": {
            "type": "string",
            "enum": [
              "minimize",
              "maximize"
            ]
          }
        },
        "required": [
          "name",
          "type"
        ],
        "additionalProperties": false
      },
      "minItems": 1
    },
    "parallelTrialCount": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "parameters": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "log": {
            "type": "boolean"
          },
          "max": {
            "type": "number"
          },
          "min": {
            "type": "number"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9._-]+$"
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9._-]+$"
          },
          "step": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "enum": [
              "int",
              "double",
              "categorical"
            ]
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name",
          "slug",
          "type"
        ],
        "additionalProperties": false
      },
      "minItems": 1
    },
    "samplerConfig": {
      "type": "object",
      "properties": {
        "constant_liar": {
          "type": "boolean"
        },
        "group": {
          "type": "boolean"
        },
        "multivariate": {
          "type": "boolean"
        },
        "n_startup_trials": {
          "type": "integer",
          "minimum": 0
        },
        "popsize": {
          "type": "integer",
          "minimum": 1
        },
        "restart_strategy": {
          "type": "string",
          "enum": [
            "ipop",
            "bipop"
          ]
        },
        "scramble": {
          "type": "boolean"
        },
        "seed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295
        },
        "sigma0": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "additionalProperties": false
    },
    "useCustomDockerImage": {
      "type": "boolean",
      "default": false
    },
    "requiredEnv": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 128,
        "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
      },
      "maxItems": 32,
      "default": []
    },
    "schemaVersion": {
      "type": "number",
      "const": 1
    }
  },
  "required": [
    "algorithm",
    "objectives",
    "parameters",
    "schemaVersion"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
