{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "GitCloneConfig",
  "type": "object",
  "additionalProperties": false,
  "required": ["repoURL", "checkout"],
  "properties": {
    "insecureSkipTLSVerify" : {
      "type": "boolean",
      "description": "Indicates whether to skip TLS verification when cloning the repository. Default is false."
    },
    "repoURL": {
      "type": "string",
      "description": "The URL of a remote Git repository to clone. Required.",
      "minLength": 1
    },
    "checkout": {
      "type": "array",
      "description": "The commits, branches, or tags to check out from the repository and the paths where they should be checked out. At least one must be specified.",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["path"],
        "properties": {
          "branch": {
            "type": "string",
            "description": "The branch to checkout. Mutually exclusive with 'commit', 'tag', and 'fromFreight=true'. If none of these are specified, the default branch is checked out."
          },
          "commit": {
            "type": "string",
            "description": "The commit to checkout. Mutually exclusive with 'branch', 'tag', and 'fromFreight=true'. If none of these are specified, the default branch is checked out."
          },
          "create": {
            "type": "boolean",
            "description": "Indicates whether a new, empty orphan branch should be created if the branch does not already exist. Default is false."
          },
          "fromFreight": {
            "type": "boolean",
            "description": "Indicates whether the ID of a commit to check out may be obtained from Freight. A value of 'true' is mutually exclusive with 'branch', 'commit', and 'tag'. If none of these are specified, the default branch is checked out."
          },
          "fromOrigin": {
            "$ref": "./common.json#/definitions/origin"
          },
          "path": {
            "type": "string",
            "description": "The path where the repository should be checked out.",
            "minLength": 1
          },
          "tag": {
            "type": "string",
            "description": "The tag to checkout. Mutually exclusive with 'branch', 'commit', and 'fromFreight=true'. If none of these are specified, the default branch is checked out."
          }
        },
        "oneOf": [
          {
            "properties": {
              "branch": { "enum": [null, ""] },
              "commit": { "enum": [null, ""] },
              "fromFreight": { "enum": [null, false] },
              "fromOrigin": { "enum": [null] },
              "tag": { "enum": [null, ""] }
            }
          },
          {
            "required": ["branch"],
            "properties": {
              "branch": { "minLength": 1 },
              "commit": { "enum": [null, ""] },
              "fromFreight": { "enum": [null, false] },
              "fromOrigin": { "enum": [null] },
              "tag": { "enum": [null, ""] }
            }
          },
          {
            "required": ["commit"],
            "properties": {
              "branch": { "enum": [null, ""] },
              "commit": { "minLength": 1 },
              "fromFreight": { "enum": [null, false] },
              "fromOrigin": { "enum": [null] },
              "tag": { "enum": [null, ""] }
            }
          },
          {
            "required": ["fromFreight"],
            "properties": {
              "branch": { "enum": [null, ""] },
              "commit": { "enum": [null, ""] },
              "fromFreight": { "const": true },
              "fromOrigin": { "oneOf": [{ "type": "object" }, { "enum": [null] }] },
              "tag": { "enum": [null, ""] }
            }
          },
          {
            "required": ["tag"],
            "properties": {
              "branch": { "enum": [null, ""] },
              "commit": { "enum": [null, ""] },
              "fromFreight": { "enum": [null, false] },
              "fromOrigin": { "enum": [null] },
              "tag": { "minLength": 1 }
            }
          }
        ]
      }
    }
  }
}
