{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "adobe-experience-cloud-segment.json",
  "title": "Adobe Experience Cloud Segment",
  "description": "An audience segment definition used across Adobe Experience Cloud products to target groups of profiles based on shared attributes, behaviors, or engagement patterns.",
  "type": "object",
  "properties": {
    "segmentId": {
      "type": "string",
      "description": "The unique identifier for the segment."
    },
    "name": {
      "type": "string",
      "description": "The human-readable name of the segment."
    },
    "description": {
      "type": "string",
      "description": "A detailed description of what the segment represents."
    },
    "expression": {
      "type": "object",
      "description": "The segment definition expression.",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["PQL"],
          "description": "The expression language type."
        },
        "format": {
          "type": "string",
          "enum": ["pql/text", "pql/json"],
          "description": "The format of the expression value."
        },
        "value": {
          "type": "string",
          "description": "The PQL expression defining the segment criteria."
        }
      },
      "required": ["type", "value"]
    },
    "evaluationType": {
      "type": "string",
      "enum": ["batch", "streaming", "edge"],
      "description": "How the segment is evaluated against profiles."
    },
    "mergePolicyId": {
      "type": "string",
      "description": "The merge policy used when evaluating this segment."
    },
    "schema": {
      "type": "object",
      "description": "The XDM schema this segment is based on.",
      "properties": {
        "name": {
          "type": "string"
        }
      }
    },
    "status": {
      "type": "string",
      "enum": ["draft", "realized", "failed"],
      "description": "The current status of the segment."
    },
    "profileCount": {
      "type": "integer",
      "description": "The estimated number of profiles in this segment."
    },
    "owner": {
      "type": "object",
      "description": "The user who created the segment.",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "tags": {
      "type": "array",
      "description": "Tags for organizing and categorizing segments.",
      "items": {
        "type": "string"
      }
    },
    "created": {
      "type": "string",
      "format": "date-time",
      "description": "When the segment was created."
    },
    "lastModified": {
      "type": "string",
      "format": "date-time",
      "description": "When the segment was last modified."
    },
    "lastEvaluated": {
      "type": "string",
      "format": "date-time",
      "description": "When the segment was last evaluated."
    }
  },
  "required": ["segmentId", "name", "expression"]
}
