{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/blackbaud/main/json-schema/blackbaud-ad-hoc-query-get-definition-response-schema.json",
  "title": "AdHocQueryGetDefinitionResponse",
  "description": "Defines the shape of an ad-hoc query definition response object.",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blackbaud-altru-analysis-api-openapi.yml#/components/schemas/AdHocQueryGetDefinitionResponse",
  "type": "object",
  "properties": {
    "owner": {
      "type": "string",
      "description": "The owner."
    },
    "added_by_user_name": {
      "type": "string",
      "description": "The added by user name."
    },
    "added_by_id": {
      "type": "string",
      "description": "The added by ID."
    },
    "changed_by_id": {
      "type": "string",
      "description": "The changed by ID."
    },
    "date_changed": {
      "type": "string",
      "description": "The date changed."
    },
    "date_added": {
      "$ref": "#/$defs/FuzzyDate"
    },
    "changed_by_user_name": {
      "type": "string",
      "description": "The changed by user name."
    },
    "record_type": {
      "type": "string",
      "description": "The record type."
    },
    "select_fields": {
      "type": "object",
      "items": {
        "$ref": "#/$defs/AdHocQueryGetDefinitionSelectFields"
      },
      "description": "The selected fields."
    },
    "filter_fields": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AdHocQueryGetDefinitionFilterFields"
      },
      "description": "The filter fields."
    },
    "sort_fields": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AdHocQueryGetDefinitionSortFields"
      },
      "description": "The sort fields."
    },
    "group_filter_fields": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AdHocQueryGetDefinitionGroupFilterFields"
      },
      "description": "The group filter fields."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "AdHocQueryGetDefinitionFilterFields": {
      "type": "object",
      "properties": {
        "object_name": {
          "type": "string",
          "description": "The object name."
        },
        "column_name": {
          "type": "string",
          "description": "The column name."
        },
        "parent_path": {
          "type": "string",
          "description": "The parent path."
        },
        "display_path": {
          "type": "string",
          "description": "The display path."
        },
        "id_set_field": {
          "type": "boolean",
          "description": "The ID set field."
        },
        "filter_operator": {
          "type": "boolean",
          "description": "The filter operator."
        },
        "field": {
          "type": "string",
          "description": "The field."
        },
        "use_left_parenthesis": {
          "type": "boolean",
          "description": "Indicates whether to use a left parenthesis."
        },
        "use_right_parenthesis": {
          "type": "boolean",
          "description": "Indicates whether to use a right parenthesis."
        },
        "left_parenthesis_count": {
          "type": "integer",
          "description": "The left parenthesis count."
        },
        "right_parenthesis_count": {
          "type": "integer",
          "description": "The right parenthesis count."
        },
        "include_blanks": {
          "type": "boolean",
          "description": "Indicates whether to include blanks."
        },
        "value_is_output_field": {
          "type": "boolean",
          "description": "Indicates whether value is output field."
        },
        "meets_all_criteria": {
          "type": "boolean",
          "description": "Indicates whether all criteria must be met."
        },
        "meets_none_of_the_criteria": {
          "type": "boolean",
          "description": "Indicates whether none of the criteria are met."
        },
        "meets_none_of_the_criteria_not_equal_to": {
          "type": "boolean",
          "description": "Indicates whether none of the not-equal-to criteria are met."
        },
        "include_current_node": {
          "type": "boolean",
          "description": "Indicates whether to include the current node."
        },
        "compare_type": {
          "type": "string",
          "description": "Compare type."
        },
        "data_mart_last_refresh": {
          "$ref": "#/$defs/FuzzyDate"
        },
        "id_set_field_info": {
          "type": "object",
          "description": "ID set field info."
        },
        "date_filter_types": {
          "type": "object",
          "description": "Date filter types."
        },
        "fuzzy_date_filter_types": {
          "type": "object",
          "description": "Fuzzy date filter types."
        },
        "month_day_filter_types": {
          "type": "object",
          "description": "Month day filter types."
        },
        "values": {
          "type": "string",
          "description": "Values."
        },
        "translated_values": {
          "type": "string",
          "description": "Translated values."
        },
        "data_type": {
          "type": "string",
          "description": "The data type."
        }
      },
      "description": "Defines the shape of an ad-hoc query definition filter field.",
      "x-display-name": "filter_fields",
      "x-display-id": "filter_fields"
    },
    "AdHocQueryGetDefinitionGroupFilterFields": {
      "type": "object",
      "properties": {
        "aggregate_type": {
          "type": "string",
          "description": "The aggregate type."
        }
      },
      "description": "Defines the shape of an ad-hoc query definition group filter field.",
      "x-display-name": "group_filter_fields",
      "x-display-id": "group_filter_fields"
    },
    "AdHocQueryGetDefinitionSelectFields": {
      "type": "object",
      "properties": {
        "column_name": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The column name."
        }
      },
      "description": "Defines the shape of an ad-hoc query definition select field.",
      "x-display-name": "select_fields",
      "x-display-id": "select_fields"
    },
    "AdHocQueryGetDefinitionSortFields": {
      "type": "object",
      "properties": {
        "field_name": {
          "type": "string",
          "description": "The field name."
        },
        "sort_order": {
          "type": "string",
          "description": "The sort order."
        }
      },
      "description": "Defines the shape of an ad-hoc query definition sort field.",
      "x-display-name": "sort_fields",
      "x-display-id": "sort_fields"
    },
    "FuzzyDate": {
      "type": "object",
      "properties": {
        "year": {
          "type": "integer",
          "description": "The year.",
          "format": "int32"
        },
        "month": {
          "type": "integer",
          "description": "The month.",
          "format": "int32"
        },
        "day": {
          "type": "integer",
          "description": "The day.",
          "format": "int32"
        }
      },
      "description": "FuzzyDate",
      "x-display-name": "Month Day",
      "x-display-id": "Month Day"
    }
  }
}