{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fluxito-app/json-schema/fluxito-app-kpipayload-schema.json",
  "title": "KPIPayload",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fluxito-app-openapi.json#/components/schemas/KPIPayload",
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 255,
      "minLength": 1,
      "title": "Name"
    },
    "slug": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 128
        },
        {
          "type": "null"
        }
      ],
      "title": "Slug"
    },
    "aliases": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Aliases"
    },
    "status": {
      "type": "string",
      "title": "Status",
      "default": "draft"
    },
    "version": {
      "type": "integer",
      "minimum": 1.0,
      "title": "Version",
      "default": 1
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "title": "Description"
    },
    "business_question": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Business Question"
    },
    "interpretation_guide": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Interpretation Guide"
    },
    "category": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ],
      "title": "Category"
    },
    "tags": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Tags"
    },
    "expression": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expression"
    },
    "time_grain": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 32
        },
        {
          "type": "null"
        }
      ],
      "title": "Time Grain"
    },
    "unit": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 32
        },
        {
          "type": "null"
        }
      ],
      "title": "Unit"
    },
    "format_spec": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ],
      "title": "Format Spec"
    },
    "direction": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 16
        },
        {
          "type": "null"
        }
      ],
      "title": "Direction"
    },
    "inputs": {
      "items": {
        "$ref": "#/$defs/KPIInputPayload"
      },
      "type": "array",
      "title": "Inputs"
    },
    "target_value": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Target Value"
    },
    "target_type": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 32
        },
        {
          "type": "null"
        }
      ],
      "title": "Target Type"
    },
    "expected_range_min": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expected Range Min"
    },
    "expected_range_max": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expected Range Max"
    },
    "owner": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Owner"
    },
    "source_of_truth_url": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 512
        },
        {
          "type": "null"
        }
      ],
      "title": "Source Of Truth Url"
    }
  },
  "type": "object",
  "required": [
    "name",
    "description"
  ],
  "$defs": {
    "KPIInputPayload": {
      "properties": {
        "key": {
          "type": "string",
          "maxLength": 32,
          "minLength": 1,
          "title": "Key"
        },
        "source": {
          "type": "string",
          "maxLength": 32,
          "minLength": 1,
          "title": "Source"
        },
        "connection_id": {
          "type": "string",
          "title": "Connection Id"
        },
        "binding": {
          "additionalProperties": true,
          "type": "object",
          "title": "Binding"
        }
      },
      "type": "object",
      "required": [
        "key",
        "source",
        "connection_id"
      ],
      "title": "KPIInputPayload",
      "description": "One bound input for a KPI expression."
    }
  }
}