{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/noderings-com/json-schema/noderings-com-v1-coupon-schema.json",
  "title": "v1Coupon",
  "description": "A discount. Codes customers type live in CouponCode. Provider coupons apply\nto that provider's plans. Platform coupons apply across providers.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/noderings-com-openapi.json#/components/schemas/v1Coupon",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "discountType": {
      "$ref": "#/$defs/v1CouponDiscountType"
    },
    "percentOff": {
      "type": "string",
      "description": "Decimal string in (0, 100] for percentage coupons."
    },
    "amountsOff": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "ISO currency to decimal amount for fixed coupons. Never converted."
    },
    "maxDiscountAmounts": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "ISO currency to per-invoice cap for percentage coupons."
    },
    "appliesTo": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Invoice line kinds: base, addon, usage."
    },
    "usageMetricCodes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "assetCategories": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Plan asset_category values that qualify, such as compute. Empty means any."
    },
    "assetTypes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Plan asset_type values that qualify, such as vm or gameserver. Empty means any."
    },
    "planIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "duration": {
      "$ref": "#/$defs/v1CouponDuration"
    },
    "durationInPeriods": {
      "type": "integer",
      "format": "int32"
    },
    "durationDays": {
      "type": "integer",
      "format": "int32"
    },
    "validFrom": {
      "type": "string",
      "format": "date-time"
    },
    "validUntil": {
      "type": "string",
      "format": "date-time"
    },
    "maxRedemptions": {
      "type": "integer",
      "format": "int32",
      "description": "0 means unlimited."
    },
    "timesRedeemed": {
      "type": "integer",
      "format": "int32"
    },
    "oncePerCustomer": {
      "type": "boolean"
    },
    "firstTimeCustomerOnly": {
      "type": "boolean"
    },
    "highRisk": {
      "type": "boolean"
    },
    "status": {
      "$ref": "#/$defs/protov1Status"
    },
    "timestamps": {
      "$ref": "#/$defs/v1Timestamps"
    },
    "fundedBy": {
      "$ref": "#/$defs/v1CouponFunding"
    },
    "creditValidDays": {
      "type": "integer",
      "format": "int32",
      "description": "Days a redeemed credit lot stays valid. Only set for credit coupons."
    }
  },
  "$defs": {
    "protov1Status": {
      "type": "string",
      "enum": [
        "STATUS_UNSPECIFIED",
        "STATUS_ACTIVE",
        "STATUS_INACTIVE",
        "STATUS_BANNED",
        "STATUS_SOFT_DELETED"
      ],
      "default": "STATUS_UNSPECIFIED",
      "title": "Status of the object"
    },
    "v1CouponDiscountType": {
      "type": "string",
      "enum": [
        "COUPON_DISCOUNT_TYPE_UNSPECIFIED",
        "COUPON_DISCOUNT_TYPE_PERCENTAGE",
        "COUPON_DISCOUNT_TYPE_FIXED",
        "COUPON_DISCOUNT_TYPE_CREDIT"
      ],
      "default": "COUPON_DISCOUNT_TYPE_UNSPECIFIED",
      "description": " - COUPON_DISCOUNT_TYPE_CREDIT: A code that grants promotional credit instead of discounting a subscription."
    },
    "v1CouponDuration": {
      "type": "string",
      "enum": [
        "COUPON_DURATION_UNSPECIFIED",
        "COUPON_DURATION_ONCE",
        "COUPON_DURATION_REPEATING",
        "COUPON_DURATION_FOREVER"
      ],
      "default": "COUPON_DURATION_UNSPECIFIED",
      "description": " - COUPON_DURATION_ONCE: Discounts the next invoice only.\n - COUPON_DURATION_REPEATING: Discounts duration_in_periods invoices, or every invoice for duration_days."
    },
    "v1CouponFunding": {
      "type": "string",
      "enum": [
        "COUPON_FUNDING_UNSPECIFIED",
        "COUPON_FUNDING_PROVIDER",
        "COUPON_FUNDING_PLATFORM"
      ],
      "default": "COUPON_FUNDING_UNSPECIFIED",
      "description": " - COUPON_FUNDING_PLATFORM: The platform funds the discount. The code applies across providers, and\neach provider still receives the amount they were owed."
    },
    "v1Timestamps": {
      "type": "object",
      "properties": {
        "createTime": {
          "type": "string",
          "format": "date-time"
        },
        "updateTime": {
          "type": "string",
          "format": "date-time"
        }
      },
      "title": "Object details"
    }
  }
}