{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/harness/main/json-schema/harness-business-mapping-schema.json",
  "title": "BusinessMapping",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/harness-cost-categories-api-openapi.yml#/components/schemas/BusinessMapping",
  "required": [
    "accountId",
    "name"
  ],
  "type": "object",
  "properties": {
    "uuid": {
      "type": "string"
    },
    "name": {
      "maxLength": 32,
      "minLength": 1,
      "pattern": "^[^\\d][^'\"\\\\]*$",
      "type": "string"
    },
    "accountId": {
      "type": "string"
    },
    "costTargets": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CostTarget"
      }
    },
    "sharedCosts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SharedCost"
      }
    },
    "unallocatedCost": {
      "$ref": "#/$defs/UnallocatedCost"
    },
    "dataSources": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "Perspective filter Category, CLUSTER means Kubernetes",
        "enum": [
          "CLUSTER",
          "AWS",
          "GCP",
          "AZURE",
          "OPENAI",
          "ANTHROPIC",
          "AI",
          "AI_TRACE",
          "EXTERNAL_DATA",
          "COMMON",
          "CUSTOM",
          "BUSINESS_MAPPING",
          "LABEL",
          "LABEL_V2"
        ]
      }
    },
    "createdAt": {
      "type": "integer",
      "format": "int64"
    },
    "lastUpdatedAt": {
      "type": "integer",
      "format": "int64"
    },
    "createdBy": {
      "$ref": "#/$defs/EmbeddedUser"
    },
    "lastUpdatedBy": {
      "$ref": "#/$defs/EmbeddedUser"
    },
    "costTargetsWithUUID": {
      "type": "array",
      "writeOnly": true,
      "items": {
        "$ref": "#/$defs/CostTarget"
      }
    }
  },
  "$defs": {
    "CostTarget": {
      "type": "object",
      "properties": {
        "name": {
          "pattern": "^[^'\"\\\\]*$",
          "type": "string"
        },
        "rules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ViewRule"
          }
        }
      }
    },
    "EmbeddedUser": {
      "type": "object",
      "properties": {
        "uuid": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "externalUserId": {
          "type": "string"
        }
      }
    },
    "SharedCost": {
      "type": "object",
      "properties": {
        "name": {
          "pattern": "^[^\\d][^'\"\\\\]*$",
          "type": "string"
        },
        "rules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ViewRule"
          }
        },
        "strategy": {
          "type": "string",
          "enum": [
            "EQUAL",
            "PROPORTIONAL",
            "FIXED"
          ]
        },
        "splits": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SharedCostSplit"
          }
        }
      }
    },
    "SharedCostSplit": {
      "type": "object",
      "properties": {
        "costTargetName": {
          "type": "string"
        },
        "percentageContribution": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "UnallocatedCost": {
      "type": "object",
      "properties": {
        "strategy": {
          "type": "string",
          "enum": [
            "DISPLAY_NAME",
            "HIDE",
            "SHARE"
          ]
        },
        "label": {
          "pattern": "^[^'\"\\\\]*$",
          "type": "string"
        },
        "sharingStrategy": {
          "type": "string",
          "enum": [
            "EQUAL",
            "PROPORTIONAL",
            "FIXED"
          ]
        },
        "splits": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SharedCostSplit"
          }
        }
      }
    },
    "ViewCondition": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        }
      },
      "description": "This object defines a filter Condition, an array of filter Conditions are combined using AND operator"
    },
    "ViewRule": {
      "type": "object",
      "properties": {
        "viewConditions": {
          "type": "array",
          "description": "The conditions that make up this rule (AND-combined). Serializes as an empty array when unset — the getter never returns null.",
          "items": {
            "$ref": "#/$defs/ViewCondition"
          }
        }
      },
      "description": "This object will contain a Perspective Rule, an array of Perspective Rules are combined using OR operator"
    }
  }
}