{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/robase-dev/json-schema/robase-dev-smsdetails-schema.json",
  "title": "SMSDetails",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/robase-dev-openapi.yaml#/components/schemas/SMSDetails",
  "type": "object",
  "required": [
    "id",
    "phone_number",
    "country_code",
    "message",
    "credit_cost",
    "status",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "phone_number": {
      "type": "string"
    },
    "country_code": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "credit_cost": {
      "type": "integer"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "sent",
        "delivered",
        "failed",
        "blocked"
      ],
      "description": "`blocked` means anti-spam screening stopped the message before any\nprovider saw it. It is terminal, and the credit was refunded in\nfull; `metadata.antispam` carries the classifier's verdict.\n"
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Whatever was sent with the message. Screening adds an `antispam`\nkey when the classifier flagged or blocked it, carrying `is_spam`,\n`score`, `category` and `reason`.\n"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "timeline": {
      "type": "array",
      "description": "Hops the message took, oldest first.",
      "items": {
        "$ref": "#/$defs/TimelineItem"
      }
    }
  },
  "$defs": {
    "TimelineItem": {
      "type": "object",
      "required": [
        "at",
        "status"
      ],
      "properties": {
        "at": {
          "type": "string",
          "format": "date-time",
          "description": "When the hop happened (RFC 3339)."
        },
        "status": {
          "type": "string",
          "description": "`queued` (charged and waiting for the worker), then the message's\nown status values: `sent`, `delivered`, `failed`, `blocked`, and for\nOTPs `verified` and `expired`. A hop is listed only when its time\nis known; `status` on the parent object is always authoritative.\n"
        },
        "reason": {
          "type": "string",
          "description": "Stable machine token. Present on a terminal hop when known, and on\n`sent` when the anti-spam screen flagged but still sent the message.\nTokens: `send_failed`, `delivery_failed`, `antispam_blocked`,\n`antispam_flagged`, `max_attempts_exceeded`, `workspace_suspended`,\n`workspace_restricted`, `kyc_required`. Omitted when unknown.\n"
        },
        "refunded": {
          "type": "boolean",
          "description": "On a terminal `failed` or `blocked` hop only. Reflects the credit\nledger: `true` means the charge was returned.\n"
        }
      }
    }
  }
}