{
  "$defs": {
    "artifact": {
      "oneOf": [
        {
          "additionalProperties": true,
          "properties": {
            "artifact_ref": {
              "pattern": "^(?!/)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u0020\\u007f\\\\:])[^\\s\\\\:]+$",
              "type": "string"
            },
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "path": {
              "pattern": "^(?!/)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u0020\\u007f\\\\:])[^\\s\\\\:]+$",
              "type": "string"
            },
            "sha256": {
              "$ref": "#/$defs/sha256"
            }
          },
          "required": [
            "id",
            "sha256",
            "path"
          ],
          "type": "object"
        },
        {
          "additionalProperties": true,
          "properties": {
            "artifact_ref": {
              "pattern": "^(?!/)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u0020\\u007f\\\\:])[^\\s\\\\:]+$",
              "type": "string"
            },
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "path": {
              "pattern": "^(?!/)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u0020\\u007f\\\\:])[^\\s\\\\:]+$",
              "type": "string"
            },
            "sha256": {
              "$ref": "#/$defs/sha256"
            }
          },
          "required": [
            "id",
            "sha256",
            "artifact_ref"
          ],
          "type": "object"
        }
      ]
    },
    "artifacts": {
      "items": {
        "$ref": "#/$defs/artifact"
      },
      "type": "array"
    },
    "identity": {
      "pattern": "^sha256:[0-9a-f]{64}$",
      "type": "string"
    },
    "runtimePayload": {
      "additionalProperties": false,
      "properties": {
        "bytes": {
          "maximum": 268435456,
          "minimum": 1,
          "type": "integer"
        },
        "id": {
          "pattern": "^[A-Za-z0-9_.:-]{1,256}$",
          "type": "string"
        },
        "kind": {
          "enum": [
            "dbt_project_bundle",
            "dbt_manifest",
            "dbt_selection_lock"
          ]
        },
        "media_type": {
          "maxLength": 200,
          "minLength": 1,
          "type": "string"
        },
        "path": {
          "pattern": "^(?!/)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u0020\\u007f\\\\:])[^\\s\\\\:]+$",
          "type": "string"
        },
        "sha256": {
          "$ref": "#/$defs/sha256"
        }
      },
      "required": [
        "id",
        "kind",
        "path",
        "sha256",
        "bytes",
        "media_type"
      ],
      "type": "object"
    },
    "sha256": {
      "pattern": "^sha256:[A-Fa-f0-9]{64}$",
      "type": "string"
    }
  },
  "$id": "https://paulkov.github.io/dpone/schemas/gitops/dbt-release-set-development-v1.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "artifacts": {
      "additionalProperties": false,
      "properties": {
        "canonical_schemas": {
          "$ref": "#/$defs/artifacts"
        },
        "dag_specs": {
          "$ref": "#/$defs/artifacts"
        },
        "runtime_payloads": {
          "items": {
            "$ref": "#/$defs/runtimePayload"
          },
          "maxItems": 64,
          "minItems": 1,
          "type": "array"
        },
        "workload_packs": {
          "$ref": "#/$defs/artifacts"
        }
      },
      "required": [
        "dag_specs",
        "workload_packs",
        "canonical_schemas",
        "runtime_payloads"
      ],
      "type": "object"
    },
    "development_authority": {
      "additionalProperties": false,
      "properties": {
        "environment": {
          "pattern": "^[a-z0-9][a-z0-9_-]{0,62}$",
          "type": "string"
        },
        "execution_subjects": {
          "items": {
            "additionalProperties": false,
            "allOf": [
              {
                "else": {
                  "not": {
                    "required": [
                      "hook_id"
                    ]
                  }
                },
                "if": {
                  "properties": {
                    "kind": {
                      "const": "pre_hook"
                    }
                  }
                },
                "then": {
                  "required": [
                    "hook_id"
                  ]
                }
              }
            ],
            "properties": {
              "hook_id": {
                "pattern": "^[a-z0-9][a-z0-9_.-]{0,249}$",
                "type": "string"
              },
              "kind": {
                "enum": [
                  "runtime",
                  "pre_hook"
                ]
              },
              "workload_id": {
                "pattern": "^[a-z0-9][a-z0-9_.-]{0,249}$",
                "type": "string"
              }
            },
            "required": [
              "workload_id",
              "kind"
            ],
            "type": "object"
          },
          "maxItems": 10000,
          "type": "array",
          "uniqueItems": true
        },
        "grant_sha256": {
          "$ref": "#/$defs/identity"
        },
        "max_source_bytes": {
          "maximum": 9223372036854775807,
          "minimum": 1,
          "type": "integer"
        },
        "max_workloads": {
          "maximum": 10000,
          "minimum": 1,
          "type": "integer"
        },
        "policy_sha256": {
          "$ref": "#/$defs/identity"
        },
        "revocation_epoch": {
          "minimum": 0,
          "type": "integer"
        },
        "schema": {
          "const": "dpone.development-authority.v1"
        },
        "signature_subject_sha256": {
          "$ref": "#/$defs/identity"
        },
        "source_commit": {
          "pattern": "^[0-9a-f]{40}$",
          "type": "string"
        },
        "source_repository_sha256": {
          "$ref": "#/$defs/identity"
        }
      },
      "required": [
        "schema",
        "policy_sha256",
        "grant_sha256",
        "signature_subject_sha256",
        "environment",
        "source_repository_sha256",
        "source_commit",
        "revocation_epoch",
        "max_workloads",
        "max_source_bytes",
        "execution_subjects"
      ],
      "type": "object"
    },
    "producer": {
      "additionalProperties": false,
      "properties": {
        "dpone_version": {
          "pattern": "^[A-Za-z0-9][A-Za-z0-9.!+_-]{0,63}$",
          "type": "string"
        },
        "wire_contract": {
          "const": "dpone.dbt-airflow-self-service.v2"
        }
      },
      "required": [
        "dpone_version",
        "wire_contract"
      ],
      "type": "object"
    },
    "promotion": {
      "additionalProperties": false,
      "properties": {
        "profile": {
          "const": "development_workspace_delivery_v1"
        },
        "schema": {
          "const": "dpone.compact-pack-release-promotion.v1"
        }
      },
      "required": [
        "schema",
        "profile"
      ],
      "type": "object"
    },
    "provenance": {
      "additionalProperties": false,
      "properties": {
        "route_certifications": {
          "maxItems": 0,
          "type": "array"
        },
        "selection_fingerprints": {
          "items": {
            "$ref": "#/$defs/identity"
          },
          "minItems": 1,
          "type": "array",
          "uniqueItems": true
        },
        "source": {
          "const": "dpone dbt compile"
        },
        "source_snapshot_sha256": {
          "$ref": "#/$defs/identity"
        }
      },
      "required": [
        "source",
        "source_snapshot_sha256",
        "selection_fingerprints",
        "route_certifications"
      ],
      "type": "object"
    },
    "release_id": {
      "$ref": "#/$defs/identity"
    },
    "schema": {
      "const": "dpone.dbt-release-set.development.v1"
    },
    "selection_authority": {
      "const": "dbt_cli"
    },
    "selection_fingerprint": {
      "$ref": "#/$defs/identity"
    }
  },
  "required": [
    "schema",
    "release_id",
    "producer",
    "selection_authority",
    "selection_fingerprint",
    "artifacts",
    "provenance",
    "development_authority"
  ],
  "title": "dpone GitOps development dbt workspace release",
  "type": "object"
}
