{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/depixapp-com/json-schema/depixapp-com-ticket-list-response-schema.json",
  "title": "TicketListResponse",
  "description": "Paginated list of the tickets created by this principal (session/key).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/depixapp-com-support-api-openapi.yml#/components/schemas/TicketListResponse",
  "type": "object",
  "required": [
    "tickets",
    "total",
    "limit",
    "offset"
  ],
  "additionalProperties": false,
  "properties": {
    "tickets": {
      "type": "array",
      "description": "Tickets created by this principal, newest activity first.",
      "items": {
        "$ref": "#/$defs/Ticket"
      }
    },
    "total": {
      "type": "integer",
      "description": "Total tickets for this principal (ignores pagination)."
    },
    "limit": {
      "type": "integer",
      "description": "Applied page size."
    },
    "offset": {
      "type": "integer",
      "description": "Applied pagination offset."
    }
  },
  "$defs": {
    "Ticket": {
      "type": "object",
      "description": "A support ticket (summary view).",
      "required": [
        "id",
        "opener_type",
        "status",
        "subject",
        "category",
        "created_at",
        "last_activity_at",
        "closed_reason",
        "closed_at",
        "rating",
        "rated_at"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "Ticket id (tkt_*)."
        },
        "opener_type": {
          "type": "string",
          "description": "Who opened the ticket, snapshotted from the account type at creation.",
          "enum": [
            "human",
            "agent"
          ]
        },
        "status": {
          "$ref": "#/$defs/TicketStatus"
        },
        "subject": {
          "type": "string",
          "description": "Ticket subject (4–120 chars)."
        },
        "category": {
          "type": "string",
          "description": "Ticket category.",
          "enum": [
            "bug",
            "question",
            "account",
            "payment",
            "other"
          ]
        },
        "created_at": {
          "type": "string",
          "description": "Creation timestamp (RFC 3339 UTC)."
        },
        "last_activity_at": {
          "type": "string",
          "description": "Timestamp of the last user/admin message (RFC 3339 UTC). System messages do not bump it."
        },
        "closed_reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Why the ticket closed: 'user', 'admin' or 'auto' — null while open."
        },
        "closed_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "Close timestamp (RFC 3339 UTC) — null while open. Anchors the 7-day reopen window for auto-closed tickets."
        },
        "rating": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 10,
          "description": "Satisfaction score the ticket owner gave (0 = worst, 10 = best) — null until rated. Only a closed ticket can be rated, and only once."
        },
        "rated_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "When the rating was submitted (RFC 3339 UTC) — null until rated."
        }
      }
    },
    "TicketStatus": {
      "type": "string",
      "description": "Ticket lifecycle status — the enum below is the complete, closed set. `closed` is terminal (an auto-closed ticket may be reopened by replying within 7 days). Terminal states (safe to stop polling): closed.",
      "enum": [
        "awaiting_reply",
        "answered",
        "closed"
      ],
      "oneOf": [
        {
          "const": "awaiting_reply",
          "description": "The ball is with support — a reply from support is pending. NEVER auto-closes."
        },
        {
          "const": "answered",
          "description": "Support replied; awaiting the user. Auto-closes after 2 business days of no user reply."
        },
        {
          "const": "closed",
          "description": "TERMINAL — closed by the user, support, or the 2-business-day auto-close sweep.",
          "x-terminal": true
        }
      ]
    }
  }
}