{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/qr-manager-ai/json-schema/qr-manager-ai-qr-code-schema.json",
  "title": "QrCode",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/qr-manager-ai-openapi.yml#/components/schemas/QrCode",
  "type": "object",
  "required": [
    "id",
    "slug",
    "qrType",
    "scanCount",
    "shortUrl",
    "fgColor",
    "bgColor",
    "dotStyle",
    "cornerStyle",
    "createdAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique internal ID (cuid)."
    },
    "slug": {
      "type": "string",
      "description": "8-character short code used in the redirect URL."
    },
    "qrType": {
      "$ref": "#/$defs/QrType"
    },
    "redirectUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "Destination URL for URL-type QR codes. Null for static types."
    },
    "qrContent": {
      "type": [
        "string",
        "null"
      ],
      "description": "Encoded data for static QR types (vCard, WiFi, SMS, etc.). Null for URL type."
    },
    "title": {
      "type": [
        "string",
        "null"
      ]
    },
    "scanCount": {
      "type": "integer",
      "description": "Total all-time scan count (bots excluded)."
    },
    "shortUrl": {
      "type": "string",
      "description": "The full scannable short URL."
    },
    "fgColor": {
      "type": "string",
      "description": "Foreground colour as a 6-digit hex string."
    },
    "bgColor": {
      "type": "string",
      "description": "Background colour as a 6-digit hex string."
    },
    "dotStyle": {
      "$ref": "#/$defs/DotStyle"
    },
    "cornerStyle": {
      "$ref": "#/$defs/CornerStyle"
    },
    "cornerDotType": {
      "$ref": "#/$defs/CornerDotType"
    },
    "eyeOuterColor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Hex colour override for the eye outer squares. Null inherits `fgColor`."
    },
    "eyeInnerColor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Hex colour override for the eye inner dots. Null inherits `fgColor`."
    },
    "gradientType": {
      "$ref": "#/$defs/GradientType",
      "nullable": true
    },
    "gradientEndColor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Second colour for the gradient. Required when `gradientType` is set."
    },
    "errorCorrectionLevel": {
      "$ref": "#/$defs/ErrorCorrectionLevel"
    },
    "logoSize": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0.1,
      "maximum": 0.4,
      "description": "Logo size as a fraction of the QR code width (0.1–0.4)."
    },
    "logoMargin": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 20,
      "description": "Padding (px) between the logo and surrounding dots."
    },
    "frameStyle": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1,
      "maximum": 16,
      "description": "Frame template (1–16). Null means no frame."
    },
    "frameColor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Hex colour for the frame. Only applies when `frameStyle` is set."
    },
    "frameText": {
      "type": [
        "string",
        "null"
      ],
      "description": "Label text shown in the frame (max 50 chars). Only applies when `frameStyle` is set."
    },
    "qrShape": {
      "$ref": "#/$defs/QrShape"
    },
    "roundSize": {
      "type": "boolean",
      "description": "Smooth dot edges by flooring sizes to integers (true = smoother, required for circle shape).",
      "default": false
    },
    "hideBackgroundDots": {
      "type": "boolean",
      "description": "Hide QR dots behind the logo image area.",
      "default": true
    },
    "bgRound": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "maximum": 1,
      "description": "Background corner rounding (0 = square, 1 = fully rounded)."
    },
    "outerMargin": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 40,
      "description": "Extra whitespace (px) around the outside of the QR code."
    },
    "expiresAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When set, the QR code stops redirecting after this datetime."
    },
    "maxScans": {
      "type": [
        "integer",
        "null"
      ],
      "description": "When set, the QR code stops redirecting after this many total scans."
    },
    "utmSource": {
      "type": [
        "string",
        "null"
      ]
    },
    "utmMedium": {
      "type": [
        "string",
        "null"
      ]
    },
    "utmCampaign": {
      "type": [
        "string",
        "null"
      ]
    },
    "safetyStatus": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "SAFE",
        "UNSAFE"
      ],
      "description": "`null` means the URL has not yet been screened."
    },
    "folder": {
      "nullable": true,
      "description": "The folder this QR code belongs to, or null if unfoldered.",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "required": [
            "id",
            "name"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          }
        }
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "CornerDotType": {
      "type": "string",
      "enum": [
        "square",
        "extra-rounded",
        "dot",
        "dots",
        "rounded",
        "classy",
        "classy-rounded"
      ],
      "default": "square",
      "description": "Style of the QR code corner finder inner dots."
    },
    "CornerStyle": {
      "type": "string",
      "enum": [
        "square",
        "extra-rounded",
        "dot",
        "dots",
        "rounded",
        "classy",
        "classy-rounded"
      ],
      "default": "square",
      "description": "Style of the QR code corner finder (eye outer) squares."
    },
    "DotStyle": {
      "type": "string",
      "enum": [
        "square",
        "dots",
        "rounded",
        "extra-rounded",
        "classy",
        "classy-rounded"
      ],
      "default": "square",
      "description": "Style of the QR code dot modules."
    },
    "ErrorCorrectionLevel": {
      "type": "string",
      "enum": [
        "L",
        "M",
        "Q",
        "H"
      ],
      "default": "M",
      "description": "Error correction capacity.\n- `L` — ~7% of codewords can be restored\n- `M` — ~15% (default)\n- `Q` — ~25%\n- `H` — ~30% (allows large logos)\n"
    },
    "GradientType": {
      "type": "string",
      "enum": [
        "linear",
        "upDown",
        "diagonal1",
        "diagonal2",
        "radial"
      ],
      "description": "Gradient direction applied to the dot modules. Requires `gradientEndColor`."
    },
    "QrShape": {
      "type": "string",
      "enum": [
        "square",
        "circle"
      ],
      "default": "square",
      "description": "Overall shape of the QR code — `square` (standard) or `circle` (circular)."
    },
    "QrType": {
      "type": "string",
      "enum": [
        "URL",
        "SHORTLINK",
        "VCARD",
        "WIFI",
        "SMS",
        "EMAIL",
        "PHONE",
        "APP_STORE",
        "SOCIAL"
      ],
      "description": "- `URL` — Dynamic redirect QR code. Destination can be updated after creation.\n- `SHORTLINK` — Short redirect URL only. No QR image; same redirect infrastructure as URL. Separate per-tier count limit.\n- `VCARD` — Contact card encoded in the QR pattern.\n- `WIFI` — WiFi credentials encoded in the QR pattern.\n- `SMS` — Pre-filled SMS encoded in the QR pattern.\n- `EMAIL` — Pre-filled email encoded in the QR pattern.\n- `PHONE` — Phone number encoded in the QR pattern.\n- `APP_STORE` — Dynamic redirect with separate iOS and Android URLs. Managed via the dashboard only.\n- `SOCIAL` — Dynamic multi-link social profile page. Managed via the dashboard only.\n"
    }
  }
}