{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-connect/json-schema/amazon-connect-get-segment-definition-response-schema.json",
  "title": "GetSegmentDefinitionResponse",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-connect-segment-definitions-api-openapi.yml#/components/schemas/GetSegmentDefinitionResponse",
  "type": "object",
  "properties": {
    "SegmentDefinitionName": {
      "type": "string",
      "description": "The name of the segment definition."
    },
    "DisplayName": {
      "type": "string",
      "description": "The display name of the segment definition."
    },
    "Description": {
      "type": "string",
      "description": "The description of the segment definition."
    },
    "SegmentGroups": {
      "$ref": "#/$defs/SegmentGroup"
    },
    "SegmentSort": {
      "$ref": "#/$defs/SegmentSort"
    },
    "SegmentDefinitionArn": {
      "type": "string",
      "description": "The arn of the segment definition."
    },
    "CreatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "The timestamp of when the segment definition was created."
    },
    "Tags": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "The tags used to organize, track, or control access for this resource."
    },
    "SegmentSqlQuery": {
      "type": "string",
      "description": "The segment SQL query."
    },
    "SegmentType": {
      "type": "string",
      "enum": [
        "CLASSIC",
        "ENHANCED"
      ],
      "description": "The segment type. Classic : Segments created using traditional SegmentGroup structure Enhanced : Segments created using SQL queries"
    }
  },
  "required": [
    "SegmentDefinitionArn"
  ],
  "$defs": {
    "AddressDimension": {
      "type": "object",
      "properties": {
        "City": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "Country": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "County": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "PostalCode": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "Province": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "State": {
          "$ref": "#/$defs/ProfileDimension"
        }
      }
    },
    "AttributeDimension": {
      "type": "object",
      "properties": {
        "DimensionType": {
          "type": "string",
          "enum": [
            "INCLUSIVE",
            "EXCLUSIVE",
            "CONTAINS",
            "BEGINS_WITH",
            "ENDS_WITH",
            "BEFORE",
            "AFTER",
            "BETWEEN",
            "NOT_BETWEEN",
            "ON",
            "GREATER_THAN",
            "LESS_THAN",
            "GREATER_THAN_OR_EQUAL",
            "LESS_THAN_OR_EQUAL",
            "EQUAL",
            "LIST_CONTAINS",
            "LIST_CONTAINS_ALL"
          ],
          "description": "The action to segment with."
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The values to apply the DimensionType on. To reference a calculated attribute or profile attribute as a dynamic value, use handlebar notation: {{_profile.ProfileAttributeName}} or {{_calculated_attribute.CalculatedAttributeName}}."
        }
      },
      "required": [
        "DimensionType",
        "Values"
      ]
    },
    "CalculatedAttributeDimension": {
      "type": "object",
      "properties": {
        "DimensionType": {
          "type": "string",
          "enum": [
            "INCLUSIVE",
            "EXCLUSIVE",
            "CONTAINS",
            "BEGINS_WITH",
            "ENDS_WITH",
            "BEFORE",
            "AFTER",
            "BETWEEN",
            "NOT_BETWEEN",
            "ON",
            "GREATER_THAN",
            "LESS_THAN",
            "GREATER_THAN_OR_EQUAL",
            "LESS_THAN_OR_EQUAL",
            "EQUAL",
            "LIST_CONTAINS",
            "LIST_CONTAINS_ALL"
          ],
          "description": "The action to segment with."
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The values to apply the DimensionType with. To reference a calculated attribute or profile attribute as a dynamic value, use handlebar notation: {{_profile.ProfileAttributeName}} or {{_calculated_attribute.CalculatedAttributeName}}."
        },
        "ConditionOverrides": {
          "$ref": "#/$defs/ConditionOverrides"
        }
      },
      "required": [
        "DimensionType",
        "Values"
      ]
    },
    "ConditionOverrides": {
      "type": "object",
      "properties": {
        "Range": {
          "$ref": "#/$defs/RangeOverride"
        }
      }
    },
    "DateDimension": {
      "type": "object",
      "properties": {
        "DimensionType": {
          "type": "string",
          "enum": [
            "BEFORE",
            "AFTER",
            "BETWEEN",
            "NOT_BETWEEN",
            "ON"
          ],
          "description": "The action to segment with."
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The values to apply the DimensionType on. To reference a calculated attribute or profile attribute as a dynamic value, use handlebar notation: {{_profile.ProfileAttributeName}} or {{_calculated_attribute.CalculatedAttributeName}}."
        }
      },
      "required": [
        "DimensionType",
        "Values"
      ]
    },
    "Dimension": {
      "type": "object",
      "properties": {
        "ProfileAttributes": {
          "$ref": "#/$defs/ProfileAttributes"
        },
        "CalculatedAttributes": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/CalculatedAttributeDimension"
          },
          "description": "Object that holds the calculated attributes to segment on."
        }
      },
      "description": "Exactly one member is set."
    },
    "ExtraLengthValueProfileDimension": {
      "type": "object",
      "properties": {
        "DimensionType": {
          "type": "string",
          "enum": [
            "INCLUSIVE",
            "EXCLUSIVE",
            "CONTAINS",
            "BEGINS_WITH",
            "ENDS_WITH"
          ],
          "description": "The action to segment with."
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The values to apply the DimensionType on. To reference a calculated attribute or profile attribute as a dynamic value, use handlebar notation: {{_profile.ProfileAttributeName}} or {{_calculated_attribute.CalculatedAttributeName}}."
        }
      },
      "required": [
        "DimensionType",
        "Values"
      ]
    },
    "Group": {
      "type": "object",
      "properties": {
        "Dimensions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Dimension"
          },
          "description": "Defines the attributes to segment on."
        },
        "SourceSegments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SourceSegment"
          },
          "description": "Defines the starting source of data."
        },
        "SourceType": {
          "type": "string",
          "enum": [
            "ALL",
            "ANY",
            "NONE"
          ],
          "description": "Defines how to interact with the source data."
        },
        "Type": {
          "type": "string",
          "enum": [
            "ALL",
            "ANY",
            "NONE"
          ],
          "description": "Defines how to interact with the profiles found in the current filtering."
        }
      }
    },
    "ProfileAttributes": {
      "type": "object",
      "properties": {
        "AccountNumber": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "AdditionalInformation": {
          "$ref": "#/$defs/ExtraLengthValueProfileDimension"
        },
        "FirstName": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "LastName": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "MiddleName": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "GenderString": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "PartyTypeString": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "BirthDate": {
          "$ref": "#/$defs/DateDimension"
        },
        "PhoneNumber": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "BusinessName": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "BusinessPhoneNumber": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "HomePhoneNumber": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "MobilePhoneNumber": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "EmailAddress": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "PersonalEmailAddress": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "BusinessEmailAddress": {
          "$ref": "#/$defs/ProfileDimension"
        },
        "Address": {
          "$ref": "#/$defs/AddressDimension"
        },
        "ShippingAddress": {
          "$ref": "#/$defs/AddressDimension"
        },
        "MailingAddress": {
          "$ref": "#/$defs/AddressDimension"
        },
        "BillingAddress": {
          "$ref": "#/$defs/AddressDimension"
        },
        "Attributes": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/AttributeDimension"
          },
          "description": "A field to describe values to segment on within attributes."
        },
        "ProfileType": {
          "$ref": "#/$defs/ProfileTypeDimension"
        }
      }
    },
    "ProfileDimension": {
      "type": "object",
      "properties": {
        "DimensionType": {
          "type": "string",
          "enum": [
            "INCLUSIVE",
            "EXCLUSIVE",
            "CONTAINS",
            "BEGINS_WITH",
            "ENDS_WITH"
          ],
          "description": "The action to segment on."
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The values to apply the DimensionType on. To reference a calculated attribute or profile attribute as a dynamic value, use handlebar notation: {{_profile.ProfileAttributeName}} or {{_calculated_attribute.CalculatedAttributeName}}."
        }
      },
      "required": [
        "DimensionType",
        "Values"
      ]
    },
    "ProfileTypeDimension": {
      "type": "object",
      "properties": {
        "DimensionType": {
          "type": "string",
          "enum": [
            "INCLUSIVE",
            "EXCLUSIVE"
          ],
          "description": "The action to segment on."
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "ACCOUNT_PROFILE",
              "PROFILE"
            ]
          },
          "description": "The values to apply the DimensionType on."
        }
      },
      "required": [
        "DimensionType",
        "Values"
      ]
    },
    "RangeOverride": {
      "type": "object",
      "properties": {
        "Start": {
          "type": "integer",
          "description": "The start time of when to include objects."
        },
        "End": {
          "type": "integer",
          "description": "The end time of when to include objects."
        },
        "Unit": {
          "type": "string",
          "enum": [
            "DAYS"
          ],
          "description": "The unit for start and end."
        }
      },
      "required": [
        "Start",
        "Unit"
      ]
    },
    "SegmentGroup": {
      "type": "object",
      "properties": {
        "Groups": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Group"
          },
          "description": "Holds the list of groups within the segment definition."
        },
        "Include": {
          "type": "string",
          "enum": [
            "ALL",
            "ANY",
            "NONE"
          ],
          "description": "Defines whether to include or exclude the profiles that fit the segment criteria."
        }
      }
    },
    "SegmentSort": {
      "type": "object",
      "properties": {
        "Attributes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SortAttribute"
          },
          "description": "A list of attributes used to sort the segments and their ordering preferences."
        }
      },
      "required": [
        "Attributes"
      ]
    },
    "SortAttribute": {
      "type": "object",
      "properties": {
        "Name": {
          "type": "string",
          "description": "The name of the attribute to sort by."
        },
        "DataType": {
          "type": "string",
          "enum": [
            "STRING",
            "NUMBER",
            "DATE"
          ],
          "description": "The data type of the sort attribute (e.g., string, number, date)."
        },
        "Order": {
          "type": "string",
          "enum": [
            "ASC",
            "DESC"
          ],
          "description": "The sort order for the attribute (ascending or descending)."
        },
        "Type": {
          "type": "string",
          "enum": [
            "PROFILE",
            "CALCULATED"
          ],
          "description": "The type of attribute (e.g., profile, calculated)."
        }
      },
      "required": [
        "Name",
        "Order"
      ]
    },
    "SourceSegment": {
      "type": "object",
      "properties": {
        "SegmentDefinitionName": {
          "type": "string",
          "description": "The unique name of the segment definition."
        }
      }
    }
  }
}