{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/swoogo/json-schema/swoogo-discount-response-schema.json",
  "title": "discountResponse",
  "description": "The discount payload returned by every read endpoint. Reflects `Discount::fields()` exactly —\nevery property is always present in the response (values may be `null`).\n",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/swoogo-openapi.yml#/components/schemas/discountResponse",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "parent_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "ID of the primary discount when this row is an alternate code; `null` (or `0`) for primary codes."
    },
    "event_id": {
      "type": "integer"
    },
    "code": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "percentage",
        "absolute",
        "specific"
      ]
    },
    "capacity": {
      "type": "integer",
      "description": "Maximum number of times this discount can be used. `0` means unlimited."
    },
    "min_group_size": {
      "type": "integer"
    },
    "registrants_per_use": {
      "type": "integer"
    },
    "sold_out_message": {
      "type": [
        "string",
        "null"
      ]
    },
    "percentage_discount": {
      "type": "number",
      "format": "float"
    },
    "absolute_discount": {
      "type": "number",
      "format": "float"
    },
    "applicable_line_items": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "apply_to_all": {
      "type": "integer",
      "enum": [
        0,
        1
      ],
      "description": "Returned as `0` or `1` (not a JSON boolean), even though the request accepts a boolean."
    },
    "custom_fees": {
      "type": [
        "object",
        "null"
      ],
      "description": "Merged set of line-item-specific fees for `specific` discounts. Outer key is the line-item\ntype (`reg_type`, `package`, `session`), inner key is the line-item ID (numeric string), value\nis the fee as a string. Populated by `custom_fees_update` on write.\n",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        }
      }
    },
    "notes": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string",
      "description": "Timestamp when the discount was created. Formatted as `YYYY-MM-DD HH:MM:SS`."
    },
    "updated_at": {
      "type": "string",
      "description": "Timestamp when the discount was last updated. Formatted as `YYYY-MM-DD HH:MM:SS`."
    }
  }
}