{
  "type": "single-step-form",
  "discriminator": {
    "backendType": {
      "type": "string"
    }
  },
  "label": {
    "text": "labels.repositories.backend.title",
    "isSubsection": true
  },
  "schema": {
    "$ref": "schema#/"
  },
  "elements": [
    {
      "type": "select",
      "label": {
        "text": "labels.repositories.backend.type"
      },
      "schema": {
        "$ref": "discriminator#/properties/backendType"
      },
      "options": [
        {
          "text": "Azure Blob Storage",
          "value": "azure"
        },
        {
          "text": "Backblaze B2",
          "value": "b2"
        },
        {
          "text": "Google Cloud Service",
          "value": "gcs"
        },
        {
          "text": "Kubernetes Persistent Volume",
          "value": "local"
        },
        {
          "text": "Rest",
          "value": "rest"
        },
        {
          "text": "AWS S3",
          "value": "s3"
        },
        {
          "text": "OpenStack Swift",
          "value": "swift"
        }
      ],
      "computed": "initBackendType",
      "onChange": "onBackendTypeChange"
    },
    {
      "type": "single-step-form",
      "if": "showBackendForm|azure",
      "schema": {
        "$ref": "schema#/properties/azure"
      },
      "elements": [
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.container"
          },
          "schema": {
            "$ref": "schema#/properties/azure/properties/container"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.prefix"
          },
          "schema": {
            "$ref": "schema#/properties/azure/properties/prefix"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.maxConnections"
          },
          "schema": {
            "$ref": "schema#/properties/azure/properties/maxConnections"
          }
        }
      ]
    },
    {
      "type": "single-step-form",
      "if": "showBackendForm|b2",
      "schema": {
        "$ref": "schema#/properties/b2"
      },
      "elements": [
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.bucket"
          },
          "schema": {
            "$ref": "schema#/properties/b2/properties/bucket"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.prefix"
          },
          "schema": {
            "$ref": "schema#/properties/b2/properties/prefix"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.maxConnections"
          },
          "schema": {
            "$ref": "schema#/properties/b2/properties/maxConnections"
          }
        }
      ]
    },
    {
      "type": "single-step-form",
      "if": "showBackendForm|gcs",
      "schema": {
        "$ref": "schema#/properties/gcs"
      },
      "elements": [
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.bucket"
          },
          "schema": {
            "$ref": "schema#/properties/gcs/properties/bucket"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.prefix"
          },
          "schema": {
            "$ref": "schema#/properties/gcs/properties/prefix"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.maxConnections"
          },
          "schema": {
            "$ref": "schema#/properties/gcs/properties/maxConnections"
          }
        }
      ]
    },
    {
      "type": "single-step-form",
      "if": "showBackendForm|local",
      "discriminator": {
        "volumeSource": {
          "type": "string"
        }
      },
      "schema": {
        "$ref": "schema#/properties/local"
      },
      "elements": [
        {
          "type": "select",
          "label": {
            "text": "labels.repositories.backend.volumeSource"
          },
          "schema": {
            "$ref": "discriminator#/properties/volumeSource"
          },
          "options": [
            {
              "text": "Host Path",
              "value": "hostPath"
            },
            {
              "text": "NFS",
              "value": "nfs"
            },
            {
              "text": "Persistant Volume Claim",
              "value": "persistentVolumeClaim"
            }
          ],
          "computed": "initVolumeSource|/resources/stashAppscodeComRepository_init_repo",
          "onChange": "onVolumeSourceChange|/resources/stashAppscodeComRepository_init_repo"
        },
        {
          "if": "showVolumeSourceForm|hostPath",
          "type": "single-step-form",
          "label": {
            "text": "Host Path form"
          },
          "schema": {
            "$ref": "schema#/properties/local/properties/hostPath"
          },
          "elements": [
            {
              "type": "input",
              "label": {
                "text": "labels.repositories.backend.path"
              },
              "schema": {
                "$ref": "schema#/properties/local/properties/hostPath/properties/path"
              }
            }
          ]
        },
        {
          "if": "showVolumeSourceForm|nfs",
          "type": "single-step-form",
          "label": {
            "text": "NFS form"
          },
          "schema": {
            "$ref": "schema#/properties/local/properties/nfs"
          },
          "elements": [
            {
              "type": "input",
              "label": {
                "text": "labels.repositories.backend.server"
              },
              "schema": {
                "$ref": "schema#/properties/local/properties/nfs/properties/server"
              }
            },
            {
              "type": "input",
              "label": {
                "text": "labels.repositories.backend.path"
              },
              "schema": {
                "$ref": "schema#/properties/local/properties/nfs/properties/path"
              }
            }
          ]
        },
        {
          "if": "showVolumeSourceForm|persistentVolumeClaim",
          "type": "single-step-form",
          "label": {
            "text": "Persistant Volume Claim form"
          },
          "schema": {
            "$ref": "schema#/properties/local/properties/persistentVolumeClaim"
          },
          "elements": [
            {
              "type": "select",
              "label": {
                "text": "labels.repositories.backend.pvcName"
              },
              "allowUserDefinedOption": true,
              "schema": {
                "$ref": "schema#/properties/local/properties/persistentVolumeClaim/properties/claimName"
              },
              "fetch": "resourceNames|core|v1|persistentvolumeclaims"
            }
          ]
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.mountPath"
          },
          "schema": {
            "$ref": "schema#/properties/local/properties/mountPath"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.subPath"
          },
          "schema": {
            "$ref": "schema#/properties/local/properties/subPath"
          }
        }
      ]
    },
    {
      "type": "single-step-form",
      "if": "showBackendForm|rest",
      "schema": {
        "$ref": "schema#/properties/rest"
      },
      "elements": [
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.url"
          },
          "schema": {
            "$ref": "schema#/properties/rest/properties/url"
          }
        }
      ]
    },
    {
      "type": "single-step-form",
      "if": "showBackendForm|s3",
      "schema": {
        "$ref": "schema#/properties/s3"
      },
      "elements": [
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.endPoint"
          },
          "schema": {
            "$ref": "schema#/properties/s3/properties/endpoint"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.bucket"
          },
          "schema": {
            "$ref": "schema#/properties/s3/properties/bucket"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.prefix"
          },
          "schema": {
            "$ref": "schema#/properties/s3/properties/prefix"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.region"
          },
          "schema": {
            "$ref": "schema#/properties/s3/properties/region"
          }
        }
      ]
    },
    {
      "type": "single-step-form",
      "if": "showBackendForm|swift",
      "schema": {
        "$ref": "schema#/properties/swift"
      },
      "elements": [
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.container"
          },
          "schema": {
            "$ref": "schema#/properties/swift/properties/container"
          }
        },
        {
          "type": "input",
          "label": {
            "text": "labels.repositories.backend.prefix"
          },
          "schema": {
            "$ref": "schema#/properties/swift/properties/prefix"
          }
        }
      ]
    },
    {
      "type": "select",
      "label": {
        "text": "labels.repositories.backend.secret"
      },
      "allowUserDefinedOption": true,
      "schema": {
        "$ref": "schema#/properties/storageSecretName"
      },
      "fetch": "resourceNames|core|v1|secrets"
    }
  ]
}