{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--service-schema.json",
  "title": "mlos_bench Service config",
  "description": "config for an mlos_bench Service - this is the top level schema that should be used to validate a Service config",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/microsoft/MLOS/main/mlos_bench/mlos_bench/config/schemas/services/service-schema.json",
    "sourceSha256": "996f486917a40453768da21f5788241af0184276fe7c0e69a456c1315db8f197"
  },
  "$defs": {
    "service_config": {
      "type": "object",
      "$comment": "additional service types should be added here",
      "allOf": [
        {
          "oneOf": [
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--config-persistence-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--local-exec-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--temp-dir-context-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--mock-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--mock-local-exec-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--mock-fileshare-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--mock-network-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--mock-vm-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--mock-remote-exec-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--mock-auth-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--ssh-host-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--ssh-fileshare-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--azure-auth-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--azure-network-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--azure-vm-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--azure-fileshare-service-subschema.json"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/mlos-config-mlos-jsonc-mlos-json5-mlos-json/_shared/latest--azure-saas-service-subschema.json"
            }
          ],
          "required": [
            "class"
          ]
        },
        {
          "type": "object",
          "properties": {
            "config": {
              "type": "object",
              "$comment": "Service-specific config.",
              "minProperties": 1
            }
          }
        }
      ]
    },
    "top_level_items": {
      "type": "object",
      "properties": {
        "$schema": {
          "description": "The schema to use for validating an Service config (accepts both URLs and local paths).",
          "type": "string",
          "$comment": "This is optional, but if provided, should match the name of this file.  However, we don't expect it to be included in nested configs, so it isn't present in the base config schema.",
          "pattern": "/schemas/services/service-schema.json$"
        },
        "description": {
          "description": "Optional description of the config.",
          "type": "string"
        }
      }
    }
  },
  "unevaluatedProperties": false,
  "oneOf": [
    {
      "description": "Single flat Service config",
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/top_level_items"
        },
        {
          "$ref": "#/$defs/service_config"
        }
      ],
      "required": [
        "class"
      ]
    },
    {
      "$comment": "We no longer accept a flat list of Service objects.",
      "description": "Object with list of Service configs.",
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/top_level_items"
        },
        {
          "type": "object",
          "properties": {
            "services": {
              "description": "List of Service configs.",
              "type": "array",
              "items": {
                "$ref": "#/$defs/service_config"
              },
              "uniqueItems": true,
              "minItems": 1
            }
          }
        }
      ],
      "required": [
        "services"
      ],
      "unevaluatedProperties": false
    }
  ]
}
