{
  "$id": "https://dpone.dev/schemas/dpone.dbt-publish-authoring.v1.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "properties": {
          "enabled": {
            "const": true
          }
        },
        "required": [
          "enabled"
        ]
      },
      "then": {
        "required": [
          "profile",
          "workflow"
        ]
      }
    }
  ],
  "properties": {
    "enabled": {
      "type": "boolean"
    },
    "execution": {
      "additionalProperties": false,
      "properties": {
        "max_parallelism": {
          "maximum": 1024,
          "minimum": 1,
          "type": "integer"
        },
        "profile": {
          "maxLength": 256,
          "minLength": 1,
          "pattern": ".*\\S.*",
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "lineage": {
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean"
        }
      },
      "required": [],
      "type": "object"
    },
    "physical_design": {
      "additionalProperties": false,
      "properties": {
        "order_by": {
          "items": {
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
            "type": "string"
          },
          "type": "array",
          "uniqueItems": true
        },
        "profile": {
          "maxLength": 256,
          "minLength": 1,
          "pattern": ".*\\S.*",
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "profile": {
      "maxLength": 256,
      "minLength": 1,
      "pattern": ".*\\S.*",
      "type": "string"
    },
    "quality": {
      "additionalProperties": false,
      "properties": {
        "preset": {
          "enum": [
            "standard",
            "strict"
          ]
        }
      },
      "required": [],
      "type": "object"
    },
    "strategy": {
      "additionalProperties": false,
      "properties": {
        "mode": {
          "enum": [
            "auto",
            "full_refresh",
            "incremental_merge",
            "partition_replace"
          ]
        },
        "partition_key": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
          "type": "string"
        },
        "unique_key": {
          "items": {
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
            "type": "string"
          },
          "type": "array",
          "uniqueItems": true
        },
        "window_days": {
          "maximum": 366,
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [],
      "type": "object"
    },
    "target": {
      "additionalProperties": false,
      "properties": {
        "schema": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
          "type": "string"
        },
        "table": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "workflow": {
      "maxLength": 256,
      "minLength": 1,
      "pattern": ".*\\S.*",
      "type": "string"
    }
  },
  "required": [
    "enabled"
  ],
  "type": "object"
}
