{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "KustomizeSetImageConfig",
  "type": "object",
  "additionalProperties": false,
  "required": ["path", "images"],
  "properties": {
    "path": {
      "type": "string",
      "description": "Path to the directory containing the Kustomization file.",
      "minLength": 1
    },
    "images": {
      "type": "array",
      "description": "Images is a list of container images to set or update in the Kustomization file.",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["image"],
        "properties": {
          "digest": {
            "type": "string",
            "description": "Digest of the image to set in the Kustomization file. Mutually exclusive with 'tag' and 'useDigest=true'."
          },
          "image": {
            "type": "string",
            "minLength": 1,
            "description": "Image name of the repository from which to pick the version. This is the image name Kargo is subscribed to, and produces Freight for."
          },
          "fromOrigin": {
            "$ref": "./common.json#/definitions/origin"
          },
          "name": {
            "type": "string",
            "description": "Name of the image (as defined in the Kustomization file)."
          },
          "newName": {
            "type": "string",
            "description": "NewName for the image. This can be used to rename the container image name in the manifests."
          },
          "tag": {
            "type": "string",
            "description": "Tag of the image to set in the Kustomization file. Mutually exclusive with 'digest' and 'useDigest=true'."
          },
          "useDigest": {
            "type": "boolean",
            "description": "UseDigest specifies whether to use the digest of the image instead of the tag."
          }
        },
        "oneOf": [
          {
            "properties": {
              "digest": { "enum": ["", null] },
              "tag": { "enum": ["", null] },
              "useDigest": { "enum": [null, false] }
            }
          },
          {
            "required": ["digest"],
            "properties": {
              "digest": { "minLength": 1 },
              "tag": { "enum": ["", null] },
              "useDigest": { "enum": [null, false] }
            }
          },
          {
            "required": ["tag"],
            "properties": {
              "digest": { "enum": ["", null] },
              "tag": { "minLength": 1 },
              "useDigest": { "enum": [null, false] }
            }
          },
          {
            "required": ["useDigest"],
            "properties": {
              "digest": { "enum": ["", null] },
              "tag": { "enum": ["", null] },
              "useDigest": { "const": true }
            }
          }
        ]
      }
    }
  }
}
