{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.horusbi.com.br/schemas/v2/credential.schema.json",
  "title": "Lumo v2 credential YAML",
  "type": "object",
  "required": [
    "header",
    "body"
  ],
  "properties": {
    "fileName": {
      "$ref": "shared.schema.json#/$defs/resourceFileName"
    },
    "header": {
      "allOf": [
        {
          "$ref": "shared.schema.json#/$defs/resourceHeaderBase"
        },
        {
          "type": "object",
          "required": [
            "id"
          ],
          "properties": {
            "kind": {
              "const": "credential"
            }
          }
        }
      ]
    },
    "body": {
      "allOf": [
        {
          "$ref": "shared.schema.json#/$defs/auditFields"
        },
        {
          "type": "object",
          "required": [
            "nome",
            "type",
            "config"
          ],
          "properties": {
            "nome": {
              "type": "string",
              "minLength": 1
            },
            "type": {
              "type": "string",
              "enum": [
                "mysql",
                "postgresql",
                "bigquery",
                "http",
                "sqlserver",
                "oracle",
                "firebird",
                "informix",
                "odbc",
                "iris"
              ]
            },
            "version": {
              "$ref": "shared.schema.json#/$defs/readOnlyVersion"
            },
            "password": {
              "type": "string",
              "description": "Editable when present; omitted on GET/self-healed YAML to keep the existing server-side secret."
            },
            "config": {
              "type": "object",
              "properties": {
                "host": {
                  "type": "string"
                },
                "port": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 65535
                },
                "database": {
                  "type": "string"
                },
                "username": {
                  "type": "string"
                },
                "password": {
                  "type": "string",
                  "description": "Editable when present; omitted on GET/self-healed YAML to keep the existing server-side secret."
                }
              },
              "additionalProperties": {
                "$ref": "shared.schema.json#/$defs/jsonValue"
              }
            },
            "tags": {
              "$ref": "shared.schema.json#/$defs/tagList"
            }
          },
          "additionalProperties": true
        }
      ]
    }
  },
  "additionalProperties": false
}
