{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lensmor/json-schema/lensmor-action-precheck-response-schema.json",
  "title": "ActionPrecheckResponse",
  "description": "Action eligibility, expected charging, reason, and action-specific detail.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lensmor-actions-api-openapi.yml#/components/schemas/ActionPrecheckResponse",
  "type": "object",
  "required": [
    "ok",
    "action_type",
    "allowed",
    "should_charge",
    "credits",
    "reason_code",
    "biz_code",
    "detail"
  ],
  "properties": {
    "ok": {
      "type": "boolean",
      "const": true,
      "description": "Whether the precheck itself completed successfully."
    },
    "action_type": {
      "type": "string",
      "description": "Action evaluated by the precheck."
    },
    "allowed": {
      "type": "boolean",
      "description": "Whether the action is currently allowed to proceed."
    },
    "should_charge": {
      "type": "boolean",
      "description": "Whether executing the action is expected to consume credits."
    },
    "credits": {
      "type": "integer",
      "description": "Credits expected for the action under the current state."
    },
    "reason_code": {
      "type": "string",
      "enum": [
        "ok",
        "already_unlocked",
        "unlock_in_progress",
        "state_conflict",
        "insufficient_balance",
        "no_contacts_available",
        "exceed_max_unlock_limit",
        "invalid_subject",
        "unsupported_action",
        "not_found",
        "forbidden",
        "system_error"
      ],
      "description": "Stable reason explaining the eligibility and charging decision."
    },
    "biz_code": {
      "type": "string",
      "description": "Business code associated with the precheck decision."
    },
    "detail": {
      "type": "object",
      "additionalProperties": true,
      "description": "Action-specific eligibility, cost, or state detail."
    }
  },
  "additionalProperties": true
}