{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agentaos-ai/json-schema/agentaos-ai-discount-code-detail-schema.json",
  "title": "DiscountCodeDetail",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agentaos-ai-discount-codes-api-openapi.yml#/components/schemas/DiscountCodeDetail",
  "allOf": [
    {
      "$ref": "#/$defs/DiscountCode"
    },
    {
      "type": "object",
      "properties": {
        "termsLabel": {
          "type": "string",
          "description": "What the code takes off, ready to print: \"20% off\", \"€5.00 off\", or \"No discount — tracking only\"."
        },
        "timesRedeemed": {
          "type": "integer",
          "description": "How many subscribers redeemed this code."
        },
        "maxRedemptions": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The cap you set, or null for none."
        }
      },
      "required": [
        "termsLabel",
        "timesRedeemed",
        "maxRedemptions"
      ]
    }
  ],
  "$defs": {
    "DiscountCode": {
      "type": "object",
      "description": "Fully camelCase on the wire.",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "code": {
          "type": "string",
          "description": "As you typed it. Buyers may type it in any case."
        },
        "kind": {
          "type": "string",
          "enum": [
            "discount",
            "tracking"
          ],
          "description": "`discount` changes the price. `tracking` changes nothing and only records who used it."
        },
        "planLinkId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The one plan this code works on; null means every subscription plan you own."
        },
        "planName": {
          "type": [
            "string",
            "null"
          ]
        },
        "archivedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "active": {
          "type": "boolean",
          "description": "Usable as far as this list can tell: not archived, and fully created. Whether the code has since been used up is answered by the single-code route."
        }
      },
      "required": [
        "id",
        "code",
        "kind",
        "planLinkId",
        "planName",
        "archivedAt",
        "createdAt",
        "active"
      ]
    }
  }
}