{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-communication-services/json-schema/microsoft-azure-communication-services-classification-policy-schema.json",
  "title": "ClassificationPolicy",
  "description": "A container for the rules that govern how jobs are classified.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-communication-services-jobrouter-api-openapi.yml#/components/schemas/ClassificationPolicy",
  "type": "object",
  "properties": {
    "etag": {
      "$ref": "#/$defs/Azure.Core.eTag",
      "description": "The entity tag for this resource.",
      "readOnly": true
    },
    "id": {
      "type": "string",
      "description": "Id of a classification policy.",
      "readOnly": true
    },
    "name": {
      "type": "string",
      "description": "Friendly name of this policy."
    },
    "fallbackQueueId": {
      "type": "string",
      "description": "Id of a fallback queue to select if queue selector attachments doesn't find a match."
    },
    "queueSelectorAttachments": {
      "type": "array",
      "description": "Queue selector attachments used to resolve a queue for a job.",
      "items": {
        "$ref": "#/$defs/QueueSelectorAttachment"
      }
    },
    "prioritizationRule": {
      "$ref": "#/$defs/RouterRule",
      "description": "A rule to determine a priority score for a job."
    },
    "workerSelectorAttachments": {
      "type": "array",
      "description": "Worker selector attachments used to attach worker selectors to a job.",
      "items": {
        "$ref": "#/$defs/WorkerSelectorAttachment"
      }
    }
  },
  "required": [
    "etag",
    "id"
  ],
  "$defs": {
    "Azure.Core.eTag": {
      "type": "string",
      "description": "The ETag (or entity tag) HTTP response header is an identifier for a specific version of a resource.\nIt lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content was not changed.\n\nIt is a string of ASCII characters placed between double quotes, like \"675af34563dc-tr34\"."
    },
    "QueueSelectorAttachment": {
      "type": "object",
      "description": "An attachment of queue selectors to resolve a queue to a job from a classification policy.",
      "properties": {
        "kind": {
          "$ref": "#/$defs/QueueSelectorAttachmentKind",
          "description": "The type discriminator describing a sub-type of QueueSelectorAttachment."
        }
      },
      "required": [
        "kind"
      ]
    },
    "QueueSelectorAttachmentKind": {
      "type": "string",
      "description": "Discriminators for supported queue selector attachment types.",
      "enum": [
        "conditional",
        "passThrough",
        "ruleEngine",
        "static",
        "weightedAllocation"
      ],
      "x-ms-enum": {
        "name": "QueueSelectorAttachmentKind",
        "modelAsString": true,
        "values": [
          {
            "name": "conditional",
            "value": "conditional",
            "description": "Discriminator value for ConditionalQueueSelectorAttachment."
          },
          {
            "name": "passThrough",
            "value": "passThrough",
            "description": "Discriminator value for PassThroughQueueSelectorAttachment."
          },
          {
            "name": "ruleEngine",
            "value": "ruleEngine",
            "description": "Discriminator value for RuleEngineQueueSelectorAttachment."
          },
          {
            "name": "static",
            "value": "static",
            "description": "Discriminator value for StaticQueueSelectorAttachment."
          },
          {
            "name": "weightedAllocation",
            "value": "weightedAllocation",
            "description": "Discriminator value for WeightedAllocationQueueSelectorAttachment."
          }
        ]
      }
    },
    "RouterRule": {
      "type": "object",
      "description": "A rule of one of the following types:\nStaticRule:  A rule providing static rules that always return the same result, regardless of input.\nDirectMapRule:  A rule that return the same labels as the input labels.\nExpressionRule: A rule providing inline expression rules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function.\nWebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol.",
      "properties": {
        "kind": {
          "$ref": "#/$defs/RouterRuleKind",
          "description": "The type discriminator describing a sub-type of RouterRule"
        }
      },
      "required": [
        "kind"
      ]
    },
    "RouterRuleKind": {
      "type": "string",
      "description": "Discriminators for supported router rule types.",
      "enum": [
        "directMap",
        "expression",
        "function",
        "static",
        "webhook"
      ],
      "x-ms-enum": {
        "name": "RouterRuleKind",
        "modelAsString": true,
        "values": [
          {
            "name": "directMap",
            "value": "directMap",
            "description": "Discriminator value for DirectMapRouterRule."
          },
          {
            "name": "expression",
            "value": "expression",
            "description": "Discriminator value for ExpressionRouterRule."
          },
          {
            "name": "function",
            "value": "function",
            "description": "Discriminator value for FunctionRouterRule."
          },
          {
            "name": "static",
            "value": "static",
            "description": "Discriminator value for StaticRouterRule."
          },
          {
            "name": "webhook",
            "value": "webhook",
            "description": "Discriminator value for WebhookRouterRule."
          }
        ]
      }
    },
    "WorkerSelectorAttachment": {
      "type": "object",
      "description": "An attachment which attaches worker selectors to a job.",
      "properties": {
        "kind": {
          "$ref": "#/$defs/WorkerSelectorAttachmentKind",
          "description": "The type discriminator describing a sub-type of WorkerSelectorAttachment."
        }
      },
      "required": [
        "kind"
      ]
    },
    "WorkerSelectorAttachmentKind": {
      "type": "string",
      "description": "Discriminators for supported worker selector attachment types.",
      "enum": [
        "conditional",
        "passThrough",
        "ruleEngine",
        "static",
        "weightedAllocation"
      ],
      "x-ms-enum": {
        "name": "WorkerSelectorAttachmentKind",
        "modelAsString": true,
        "values": [
          {
            "name": "conditional",
            "value": "conditional",
            "description": "Discriminator value for ConditionalWorkerSelectorAttachment."
          },
          {
            "name": "passThrough",
            "value": "passThrough",
            "description": "Discriminator value for PassThroughWorkerSelectorAttachment."
          },
          {
            "name": "ruleEngine",
            "value": "ruleEngine",
            "description": "Discriminator value for RuleEngineWorkerSelectorAttachment."
          },
          {
            "name": "static",
            "value": "static",
            "description": "Discriminator value for StaticWorkerSelectorAttachment."
          },
          {
            "name": "weightedAllocation",
            "value": "weightedAllocation",
            "description": "Discriminator value for WeightedAllocationWorkerSelectorAttachment."
          }
        ]
      }
    }
  }
}