{
  "$id": "adapter-db_sybase",
  "type": "object",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "database": {
      "type": "string",
      "description": "The name of the database",
      "default": "test",
      "examples": [
        "test"
      ]
    },
    "host": {
      "type": "string",
      "description": "Host where the MicrosoftSQL database resides.",
      "default": "localhost",
      "examples": [
        "localhost"
      ]
    },
    "port": {
      "type": "integer",
      "description": "Port to be used to connect to MicrosoftSQL.",
      "default": 27017,
      "minimum": 1,
      "maximum": 65535
    },
    "encrypt": {
      "type": "boolean",
      "description": "Whether the connection should be encrypted",
      "default": true
    },
    "authentication": {
      "$ref":"#/definitions/authentication"
    },
    "ssl": {
      "$ref":"#/definitions/ssl"
    }
  },
  "required" : ["database","host","port"],
  "definitions": {
    "authentication": {
      "$id": "/authentication",
      "type": "object",
      "properties": {
        "dbAuth" : {
            "$id" : "/credentials/properties/dbAuth",
            "type" : "boolean",
            "description": "whether or not to use user authentication to connect to sybase",
            "default" : false
        },
        "password": {
          "type": "string",
          "description": "Password used when authentication is enabled.",
          "default": "pronghorn",
          "examples": [
            "itentialPassword"
          ]
        },
        "username": {
          "type": "string",
          "description": "Username used when authentication is enabled.",
          "default": "pronghorn",
          "examples": [
            "itentialUser"
          ]
        }
      },
      "required" : ["username","password"]
    },
    "ssl": {
      "$id": "/ssl",
      "type": "object",
      "properties": {
        "enabled": {
          "$id": "/ssl/properties/enabled",
          "type": "boolean",
          "description": "Whether or not ssl is enabled on PostgreSQL",
          "default": false            
        },
        "accept_invalid_cert": {
          "$id": "/ssl/properties/accept_invalid_cert",
          "type": "boolean",
          "description": "Whether IAP should be configured to accept invalid certificates",
          "default": false
        },
        "ca_file": {
          "$id": "/ssl/properties/ca_file",
          "type": "string",
          "description": "The fully qualified path name to the CA pem file used for SSL",
          "default": "",
          "examples": [
            "keys/key.pem"
          ]
        }
      },
      "required" : ["enabled"],
      "allOf": [
        {
          "if" : { "properties" : { "enabled": { "enum": [true] } } },
          "then" : { "required" : ["acceptInvalidCerts", "checkServerIdentity"] }
        },
        {
          "if" : { "allOf": [ 
            { "properties" : { "enabled": { "enum": [true] } } },
            { "properties" : { "acceptInvalidCerts": { "enum": [ false ] } } }
          ] },
          "then" : { "required" : ["sslCA"] }
        }
      ]
    }
  }
}
