{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://phuhh98.github.io/sloth/schemas/cli-config/0.0.1/schema.json",
  "title": "Sloth CLI Config",
  "description": "Schema for .sloth/config.yaml used by sloth CLI profile resolution.",
  "type": "object",
  "required": ["profiles"],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string"
    },
    "currentProfile": {
      "type": "string",
      "minLength": 1
    },
    "profiles": {
      "type": "object",
      "minProperties": 1,
      "patternProperties": {
        "^[A-Za-z0-9_-]+$": {
          "$ref": "#/$defs/profile"
        }
      },
      "additionalProperties": false
    }
  },
  "$defs": {
    "profile": {
      "type": "object",
      "required": ["host"],
      "additionalProperties": false,
      "properties": {
        "host": {
          "type": "string",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "token": {
          "type": "string"
        },
        "authorizationToken": {
          "type": "string"
        },
        "registry": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "host": {
              "type": "string",
              "minLength": 1
            },
            "repository": {
              "type": "string",
              "minLength": 1,
              "pattern": "^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*$"
            },
            "useAuthorizationToken": {
              "type": "boolean"
            }
          }
        }
      }
    }
  }
}
