{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ucp.dev/draft/schemas/shopping/types/card_payment_instrument.json",
  "title": "Card Payment Instrument",
  "description": "A basic card payment instrument with visible card details. Can be inherited by a handler's instrument schema to define handler-specific display details or more complex credential structures.",
  "$defs": {
    "available_card_payment_instrument": {
      "title": "Available Card Payment Instrument",
      "description": "Declares card instrument availability with card-specific constraints.",
      "allOf": [
        {
          "$ref": "https://ucp.dev/draft/schemas/shopping/types/available_payment_instrument.json"
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "card"
            },
            "constraints": {
              "type": "object",
              "properties": {
                "brands": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "minItems": 1,
                  "uniqueItems": true,
                  "description": "Limit to specific card brands (e.g., ['visa', 'mastercard', 'amex'])."
                }
              }
            }
          }
        }
      ]
    }
  },
  "allOf": [
    {
      "$ref": "https://ucp.dev/draft/schemas/shopping/types/payment_instrument.json"
    },
    {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "card",
          "description": "Indicates this is a card payment instrument."
        },
        "display": {
          "type": "object",
          "description": "Display information for this card payment instrument.",
          "properties": {
            "brand": {
              "type": "string",
              "description": "The card brand/network (e.g., visa, mastercard, amex)."
            },
            "last_digits": {
              "type": "string",
              "description": "Last 4 digits of the card number."
            },
            "expiry_month": {
              "type": "integer",
              "description": "The month of the card's expiration date (1-12)."
            },
            "expiry_year": {
              "type": "integer",
              "description": "The year of the card's expiration date."
            },
            "description": {
              "type": "string",
              "description": "An optional rich text description of the card to display to the user (e.g., 'Visa ending in 1234, expires 12/2025')."
            },
            "card_art": {
              "type": "string",
              "format": "uri",
              "description": "An optional URI to a rich image representing the card (e.g., card art provided by the issuer)."
            }
          }
        }
      }
    }
  ]
}