{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/briefcase/latest.json",
  "title": "MLBriefcase",
  "description": "A ML briefcase schema",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/microsoft/Briefcase/master/mlbriefcase/briefcase-schema.json",
    "sourceSha256": "54277cde170757d73f060f0b0b4c2bbf9f2ff8e8ead7773458cd3e262f33f0c5",
    "fileMatch": [
      "briefcase.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "azure": {
      "description": "Azure services",
      "type": "object",
      "properties": {
        "auth": {
          "description": "Azure authentication services",
          "type": "object",
          "properties": {
            "devicecode": {
              "description": "Azure Device Code authentication",
              "type": "array",
              "items": {
                "description": "Azure Device Code authentication. Prompts the user with a URL.",
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "$ref": "#/$defs/azureTenantId"
                  },
                  {
                    "properties": {
                      "name": {
                        "default": "devicecode"
                      }
                    }
                  }
                ]
              }
            },
            "managedserviceidentity": {
              "description": "Azure Managed Service Idenity",
              "type": "array",
              "items": {
                "description": "Azure Managed Service Identity (https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview)",
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  }
                ]
              }
            },
            "serviceprincipal": {
              "description": "Azure Service Princiapl",
              "type": "array",
              "items": {
                "description": "Azure Service Principal",
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "$ref": "#/$defs/azureTenantId"
                  },
                  {
                    "properties": {
                      "name": {
                        "default": "serviceprincipal"
                      },
                      "clientid": {
                        "$ref": "#/$defs/property",
                        "description": "TODO The client id (a guid)"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "subscription": {
          "description": "Azure Subscription",
          "type": "array",
          "items": {
            "description": "Azure Subscription",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/$defs/resource"
              },
              {
                "properties": {
                  "id": {
                    "$ref": "#/$defs/property",
                    "description": "Azure subscription id (e.g. guids)"
                  },
                  "ids": {
                    "type": "array",
                    "description": "List of Azure subscription ids (e.g. guids)",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            ]
          }
        },
        "keyvault": {
          "description": "Azure KeyVaults",
          "type": "array",
          "items": {
            "description": "Azure KeyVault <https://docs.microsoft.com/en-us/azure/key-vault>",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/$defs/resource"
              },
              {
                "$ref": "#/$defs/azureTenantId"
              },
              {
                "properties": {
                  "name": {
                    "default": "keyvault"
                  },
                  "dnsname": {
                    "$ref": "#/$defs/property",
                    "description": "DNS for the Azure KeyVault instance",
                    "default": "https://<name>.vault.azure.net/",
                    "examples": [
                      "https://example1.vault.azure.net/"
                    ]
                  },
                  "credential": {
                    "$ref": "#/$defs/property",
                    "description": "Name of credential resource. E.g. device code or service principal resource"
                  }
                }
              }
            ]
          }
        },
        "cognitiveservice": {
          "type": "object",
          "description": "Azure Cognitive Services",
          "properties": {
            "anomalydetection": {
              "type": "array",
              "description": "Azure Cognitive Service Anomaly Detection",
              "items": {
                "description": "Azure Cognitive Service Anomaly Detection (https://docs.microsoft.com/en-us/azure/cognitive-services/anomaly-detector/)",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "properties": {
                      "url": {
                        "$ref": "#/$defs/property",
                        "description": "End point URL for Azure Cognitive Service",
                        "default": "https://<your-custom-subdomain>.api.cognitive.microsoft.com/anomalydetector/v1.0/timeseries/entire/detect",
                        "examples": [
                          "https://example1.api.cognitive.microsoft.com/anomalydetector/v1.0/timeseries/entire/detect"
                        ]
                      }
                    }
                  }
                ]
              }
            },
            "contentmoderator": {
              "type": "array",
              "description": "Azure Cognitive Service Content Moderator",
              "items": {
                "description": "Azure Cognitive Service Content Moderator",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "properties": {
                      "url": {
                        "$ref": "#/$defs/property",
                        "description": "End point URL for Azure Cognitive Service",
                        "default": "https://<your-custom-subdomain>.api.cognitive.microsoft.com/",
                        "examples": [
                          "https://example1.api.cognitive.microsoft.com/"
                        ]
                      }
                    }
                  }
                ]
              }
            },
            "face": {
              "type": "array",
              "description": "Azure Cognitive Service Face",
              "items": {
                "description": "Azure Cognitive Service Face (https://azure.microsoft.com/en-us/services/cognitive-services/face/)",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "properties": {
                      "url": {
                        "$ref": "#/$defs/property",
                        "description": "End point URL for Azure Cognitive Service",
                        "default": "https://<your-custom-subdomain>.api.cognitive.microsoft.com",
                        "examples": [
                          "https://example1.api.cognitive.microsoft.com"
                        ]
                      }
                    }
                  }
                ]
              }
            },
            "spellcheck": {
              "type": "array",
              "description": "Azure Cognitive Service Spell Checker",
              "items": {
                "description": "Azure Cognitive Service Spell Checker",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "properties": {
                      "url": {
                        "$ref": "#/$defs/property",
                        "description": "End point URL for Azure Cognitive Service",
                        "default": "https://<your-custom-subdomain>.api.cognitive.microsoft.com/",
                        "examples": [
                          "https://example1.api.cognitive.microsoft.com/"
                        ]
                      }
                    }
                  }
                ]
              }
            },
            "textanalytics": {
              "type": "array",
              "description": "Azure Cognitive Service Text Analytics",
              "items": {
                "description": "Azure Cognitive Service Text Analytics",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "properties": {
                      "url": {
                        "$ref": "#/$defs/property",
                        "description": "End point URL for Azure Cognitive Service",
                        "default": "https://<your-custom-subdomain>.api.cognitive.microsoft.com",
                        "examples": [
                          "https://example1.api.cognitive.microsoft.com"
                        ]
                      }
                    }
                  }
                ]
              }
            },
            "vision": {
              "type": "array",
              "description": "Azure Cognitive Service Vision",
              "items": {
                "description": "Azure Cognitive Service Vision",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "properties": {
                      "url": {
                        "$ref": "#/$defs/property",
                        "description": "End point URL for Azure Cognitive Service",
                        "default": "https://<your-custom-subdomain>.api.cognitive.microsoft.com",
                        "examples": [
                          "https://example1.api.cognitive.microsoft.com"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "storage": {
          "type": "object",
          "description": "Azure Storage Services",
          "properties": {
            "account": {
              "type": "array",
              "description": "Azure Storage Account",
              "items": {
                "description": "Azure Storage Account",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "properties": {
                      "accountname": {
                        "$ref": "#/$defs/property",
                        "description": "Azure blob account name"
                      },
                      "accountkey": {
                        "$ref": "#/$defs/property",
                        "description": "Azure blob account key"
                      },
                      "secrettype": {
                        "$ref": "#/$defs/property",
                        "description": "Is the secret a key or SAS token",
                        "default": "key",
                        "enum": [
                          "key",
                          "sas"
                        ]
                      }
                    }
                  }
                ]
              }
            },
            "blob": {
              "type": "array",
              "description": "Azure Blob Storage",
              "items": {
                "description": "Azure Blob Storage",
                "allOf": [
                  {
                    "$ref": "#/$defs/resource"
                  },
                  {
                    "properties": {
                      "url": {
                        "$ref": "#/$defs/property",
                        "description": "URL to Azure blob"
                      },
                      "account": {
                        "$ref": "#/$defs/property",
                        "description": "Name of Azure Storage account resource object"
                      },
                      "containername": {
                        "$ref": "#/$defs/property",
                        "description": "Name of container"
                      },
                      "path": {
                        "$ref": "#/$defs/property",
                        "description": "Path to blob"
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "amazon": {
      "type": "object",
      "description": "Amazon Web Services (AWS)",
      "properties": {
        "rekognition": {
          "type": "array",
          "items": {
            "type": "object",
            "description": "AWS Rekognition services",
            "$ref": "#/$defs/awsBoto3"
          }
        },
        "comprehend": {
          "type": "array",
          "items": {
            "description": "AWS Rekognition services",
            "$ref": "#/$defs/awsBoto3"
          }
        }
      }
    },
    "google": {
      "type": "object",
      "description": "Google Cloud Platform services",
      "properties": {
        "language": {
          "type": "array",
          "description": "Google NER service",
          "items": {
            "$ref": "#/$defs/resource"
          }
        },
        "video": {
          "type": "array",
          "description": "Google video intelligence for content moderation annotation",
          "items": {
            "$ref": "#/$defs/resource"
          }
        },
        "vision": {
          "type": "array",
          "description": "Google Face Detect SDK",
          "items": {
            "$ref": "#/$defs/resource"
          }
        }
      }
    },
    "clarifai": {
      "type": "object",
      "description": "ClarifAI Services",
      "properties": {
        "moderation": {
          "type": "array",
          "description": "Clarifai Moderation image SDK",
          "items": {
            "description": "Clarifai Moderation image SDK",
            "$ref": "#/$defs/resource"
          }
        }
      }
    },
    "python": {
      "description": "Python specific resources",
      "properties": {
        "jupyterlabCredentialProvider": {
          "description": "JupyterLab Credential Provider",
          "$ref": "#/$defs/resource"
        },
        "env": {
          "description": "Environment variable Credential Provider",
          "$ref": "#/$defs/resource"
        },
        "dotenv": {
          "description": ".env file Credential Provider",
          "$ref": "#/$defs/resource"
        },
        "keyring": {
          "description": "Python KeyRing Credential Provider (https://pypi.org/project/keyring)",
          "type": "array",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/resource"
              },
              {
                "type": "object",
                "properties": {
                  "service_name": {
                    "$ref": "#/$defs/property",
                    "description": "Service name used when calling get_password"
                  }
                }
              }
            ]
          }
        },
        "sqlalchemy": {
          "description": "Python SQL Alchemy (https://www.sqlalchemy.org/)",
          "type": "array",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/resource"
              },
              {
                "type": "object",
                "properties": {
                  "url": {
                    "$ref": "#/$defs/property",
                    "description": "drivername://username:password@host/path?query"
                  },
                  "drivername": {
                    "$ref": "#/$defs/property",
                    "description": "the name of the database backend. This name will correspond to a module in sqlalchemy/databases or a third party plug-in."
                  },
                  "username": {
                    "$ref": "#/$defs/property",
                    "description": "The user name."
                  },
                  "host": {
                    "$ref": "#/$defs/property",
                    "description": "The name of the host."
                  },
                  "port": {
                    "$ref": "#/$defs/property",
                    "description": "The port number."
                  },
                  "database": {
                    "$ref": "#/$defs/property",
                    "description": "The database name."
                  },
                  "query": {
                    "$ref": "#/$defs/property",
                    "description": "A dictionary of options to be passed to the dialect and/or the DBAPI upon connect."
                  }
                }
              }
            ]
          }
        }
      }
    }
  },
  "$defs": {
    "resource": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of this resource"
        },
        "credentialprovider": {
          "type": "string",
          "description": "Name of the credential provider to be used."
        },
        "secret": {
          "$ref": "#/$defs/property"
        },
        "metadata": {
          "type": "object",
          "description": "Allows to attach user-definied metadata to resources"
        }
      }
    },
    "property": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "properties": {
            "key": {
              "type": "string",
              "description": "Overrides the key to lookup the value for the property."
            }
          }
        }
      ]
    },
    "azureTenantId": {
      "type": "object",
      "properties": {
        "tenantid": {
          "$ref": "#/$defs/property",
          "description": "Azure tenant id (a GUID)",
          "examples": [
            "72f988bf-86f1-41af-91ab-2d7cd011db47"
          ]
        }
      }
    },
    "awsBoto3": {
      "type": "object",
      "description": "AWS Boto3",
      "allOf": [
        {
          "$ref": "#/$defs/resource"
        },
        {
          "type": "object",
          "properties": {
            "region_name": {
              "$ref": "#/$defs/property",
              "description": "Region name"
            },
            "key_id": {
              "$ref": "#/$defs/property",
              "description": "AWS Access Key ID"
            }
          }
        }
      ]
    }
  }
}
