{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nudgelink-co/json-schema/nudgelink-co-admin-client-detail-schema.json",
  "title": "AdminClientDetail",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nudgelink-co-openapi.json#/components/schemas/AdminClientDetail",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id"
    },
    "email": {
      "type": "string",
      "title": "Email"
    },
    "company_name": {
      "type": "string",
      "title": "Company Name"
    },
    "industry": {
      "type": "string",
      "title": "Industry"
    },
    "role": {
      "type": "string",
      "title": "Role"
    },
    "subscription_plan": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Subscription Plan"
    },
    "plan_comped": {
      "type": "boolean",
      "title": "Plan Comped"
    },
    "guarantee_status": {
      "type": "string",
      "title": "Guarantee Status"
    },
    "pilot_start_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Pilot Start At"
    },
    "pilot_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Pilot Expires At"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "email_verified": {
      "type": "boolean",
      "title": "Email Verified"
    },
    "totp_enabled": {
      "type": "boolean",
      "title": "Totp Enabled"
    },
    "google_sub": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Google Sub"
    },
    "microsoft_sub": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Microsoft Sub"
    },
    "disabled": {
      "type": "boolean",
      "title": "Disabled"
    },
    "campaign_first_ux": {
      "type": "boolean",
      "title": "Campaign First Ux",
      "default": false
    },
    "credits_balance": {
      "type": "integer",
      "title": "Credits Balance"
    },
    "credits_included": {
      "type": "integer",
      "title": "Credits Included"
    },
    "credits_used_this_cycle": {
      "type": "integer",
      "title": "Credits Used This Cycle"
    },
    "billing_cycle_start": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Billing Cycle Start"
    },
    "outreach_auto_send": {
      "type": "boolean",
      "title": "Outreach Auto Send"
    },
    "languages": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Languages"
    },
    "calibration_anchors": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Calibration Anchors"
    },
    "icp_summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Icp Summary"
    },
    "icp_criteria": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Icp Criteria",
      "default": []
    },
    "icp_keywords": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Icp Keywords",
      "default": []
    },
    "icp_industries": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Icp Industries",
      "default": []
    },
    "icp_skills": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Icp Skills",
      "default": []
    },
    "icp_locations": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Icp Locations",
      "default": []
    },
    "extra_accounts_count": {
      "type": "integer",
      "title": "Extra Accounts Count"
    },
    "avg_deal_size_usd": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Avg Deal Size Usd"
    },
    "has_stripe_subscription": {
      "type": "boolean",
      "title": "Has Stripe Subscription"
    },
    "total_paid_usd": {
      "type": "number",
      "title": "Total Paid Usd"
    },
    "total_refunded_usd": {
      "type": "number",
      "title": "Total Refunded Usd"
    },
    "comped_credits_total": {
      "type": "integer",
      "title": "Comped Credits Total"
    },
    "net_revenue_usd": {
      "type": "number",
      "title": "Net Revenue Usd"
    },
    "lead_count": {
      "type": "integer",
      "title": "Lead Count"
    },
    "sequence_counts": {
      "additionalProperties": {
        "type": "integer"
      },
      "type": "object",
      "title": "Sequence Counts"
    },
    "account_count": {
      "type": "integer",
      "title": "Account Count"
    },
    "accounts": {
      "items": {
        "$ref": "#/$defs/AdminAccountMini"
      },
      "type": "array",
      "title": "Accounts"
    },
    "recent_sequences": {
      "items": {
        "$ref": "#/$defs/AdminSequenceMini"
      },
      "type": "array",
      "title": "Recent Sequences"
    },
    "recent_billing": {
      "items": {
        "$ref": "#/$defs/AdminBillingMini"
      },
      "type": "array",
      "title": "Recent Billing"
    },
    "recent_bookkeeping": {
      "items": {
        "$ref": "#/$defs/AdminBillingMini"
      },
      "type": "array",
      "title": "Recent Bookkeeping",
      "default": []
    },
    "recent_audit": {
      "items": {
        "$ref": "#/$defs/AdminAuditMini"
      },
      "type": "array",
      "title": "Recent Audit"
    },
    "responded_leads": {
      "items": {
        "$ref": "#/$defs/AdminRespondedLead"
      },
      "type": "array",
      "title": "Responded Leads"
    },
    "outreach_stats": {
      "$ref": "#/$defs/AdminClientOutreachStats"
    },
    "outreach": {
      "$ref": "#/$defs/OutreachStats"
    }
  },
  "type": "object",
  "required": [
    "id",
    "email",
    "company_name",
    "industry",
    "role",
    "subscription_plan",
    "plan_comped",
    "guarantee_status",
    "pilot_start_at",
    "pilot_expires_at",
    "created_at",
    "email_verified",
    "totp_enabled",
    "google_sub",
    "microsoft_sub",
    "disabled",
    "credits_balance",
    "credits_included",
    "credits_used_this_cycle",
    "billing_cycle_start",
    "outreach_auto_send",
    "languages",
    "extra_accounts_count",
    "avg_deal_size_usd",
    "has_stripe_subscription",
    "total_paid_usd",
    "total_refunded_usd",
    "comped_credits_total",
    "net_revenue_usd",
    "lead_count",
    "sequence_counts",
    "account_count",
    "accounts",
    "recent_sequences",
    "recent_billing",
    "recent_audit",
    "responded_leads",
    "outreach_stats",
    "outreach"
  ],
  "$defs": {
    "AdminAccountMini": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id"
        },
        "label": {
          "type": "string",
          "title": "Label"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "warmup_week": {
          "type": "integer",
          "title": "Warmup Week"
        },
        "ban_count": {
          "type": "integer",
          "title": "Ban Count"
        },
        "last_action_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Action At"
        }
      },
      "type": "object",
      "required": [
        "id",
        "label",
        "status",
        "warmup_week",
        "ban_count",
        "last_action_at"
      ],
      "title": "AdminAccountMini"
    },
    "AdminAuditMini": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        },
        "actor_role": {
          "type": "string",
          "title": "Actor Role"
        },
        "action": {
          "type": "string",
          "title": "Action"
        },
        "resource_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Resource Type"
        },
        "resource_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Resource Id"
        }
      },
      "type": "object",
      "required": [
        "id",
        "created_at",
        "actor_role",
        "action",
        "resource_type",
        "resource_id"
      ],
      "title": "AdminAuditMini"
    },
    "AdminBillingMini": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id"
        },
        "event_type": {
          "type": "string",
          "title": "Event Type"
        },
        "amount": {
          "type": "number",
          "title": "Amount"
        },
        "reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        }
      },
      "type": "object",
      "required": [
        "id",
        "event_type",
        "amount",
        "reason",
        "created_at"
      ],
      "title": "AdminBillingMini"
    },
    "AdminClientOutreachStats": {
      "properties": {
        "invites_sent": {
          "type": "integer",
          "title": "Invites Sent"
        },
        "messages_sent": {
          "type": "integer",
          "title": "Messages Sent"
        },
        "replies": {
          "type": "integer",
          "title": "Replies"
        },
        "positive_replies": {
          "type": "integer",
          "title": "Positive Replies"
        },
        "reply_rate_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reply Rate Pct"
        },
        "positive_rate_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Positive Rate Pct"
        }
      },
      "type": "object",
      "required": [
        "invites_sent",
        "messages_sent",
        "replies",
        "positive_replies",
        "reply_rate_pct",
        "positive_rate_pct"
      ],
      "title": "AdminClientOutreachStats",
      "description": "Per-client outreach success funnel (board ask 2026-07-13: \"% successful\nanswers\" on the client's admin page). Denominator is invites actually SENT\n— a connection request that left the building — not leads merely found, so\nthe rate isn't diluted by warmup-heavy pilots that haven't invited yet.\nreply_rate / positive_rate are None when nothing has been sent yet."
    },
    "AdminRespondedLead": {
      "properties": {
        "lead_id": {
          "type": "string",
          "format": "uuid",
          "title": "Lead Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "company": {
          "type": "string",
          "title": "Company"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "relevance_score": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Relevance Score"
        },
        "last_inbound_text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Inbound Text"
        },
        "last_inbound_classification": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Inbound Classification"
        },
        "last_inbound_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Inbound At"
        }
      },
      "type": "object",
      "required": [
        "lead_id",
        "name",
        "company",
        "title",
        "status",
        "relevance_score",
        "last_inbound_text",
        "last_inbound_classification",
        "last_inbound_at"
      ],
      "title": "AdminRespondedLead",
      "description": "A lead who replied/converted, with a snapshot of their latest inbound\nmessage. Part 3 (Sofia's admin ask): lets an operator see who actually\nresponded and what they said, to judge message quality end-to-end."
    },
    "AdminSequenceMini": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id"
        },
        "lead_id": {
          "type": "string",
          "format": "uuid",
          "title": "Lead Id"
        },
        "lead_name": {
          "type": "string",
          "title": "Lead Name"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "current_step": {
          "type": "string",
          "title": "Current Step"
        },
        "next_action_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Next Action At"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At"
        }
      },
      "type": "object",
      "required": [
        "id",
        "lead_id",
        "lead_name",
        "status",
        "current_step",
        "next_action_at",
        "updated_at"
      ],
      "title": "AdminSequenceMini"
    },
    "InviteStats": {
      "properties": {
        "sent": {
          "type": "integer",
          "title": "Sent",
          "default": 0
        },
        "with_note": {
          "type": "integer",
          "title": "With Note",
          "default": 0
        },
        "without_note": {
          "type": "integer",
          "title": "Without Note",
          "default": 0
        },
        "accepted": {
          "type": "integer",
          "title": "Accepted",
          "default": 0
        },
        "accepted_with_note": {
          "type": "integer",
          "title": "Accepted With Note",
          "default": 0
        },
        "accepted_without_note": {
          "type": "integer",
          "title": "Accepted Without Note",
          "default": 0
        },
        "declined": {
          "type": "integer",
          "title": "Declined",
          "default": 0
        },
        "unknown": {
          "type": "integer",
          "title": "Unknown",
          "default": 0
        },
        "judged": {
          "type": "integer",
          "title": "Judged",
          "default": 0
        },
        "judged_with_note": {
          "type": "integer",
          "title": "Judged With Note",
          "default": 0
        },
        "judged_without_note": {
          "type": "integer",
          "title": "Judged Without Note",
          "default": 0
        },
        "accept_rate_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Accept Rate Pct"
        },
        "accept_rate_with_note_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Accept Rate With Note Pct"
        },
        "accept_rate_without_note_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Accept Rate Without Note Pct"
        }
      },
      "type": "object",
      "title": "InviteStats",
      "description": "Connection requests. ``*_pct`` are None (never 0.0) on an empty base.\n\nTHREE outcomes, not two (added 2026-08-07 after the first production\nbackfill). An invite we sent is in exactly one of:\n\n  * **accepted**  — ``invite_accepted_at`` is stamped.\n  * **declined**  — we looked AFTER inviting and they are still not a\n    connection. \"Declined\" is shorthand: it also covers ignored.\n  * **unknown**   — we have no observation since the invite went out.\n\nThat third bucket is not a technicality. Relationship distance is only\nrefreshed by the DM gate, which runs when a sequence reaches\n``linkedin_followup_1``; ``warmup_view``'s blob is written BEFORE the invite\nand carries no timestamp at all. So a lead whose follow-up is still sitting\nin the preview queue has never been re-checked, and folding those into the\ndenominator reports them as rejections.\n\nThe first prod run showed exactly that: 379 invites, 376 \"not 1st-degree\",\nan 0.8% accept rate. Real cold-invite accept rates are 15-40%. Nearly all of\nthat 376 was \"we never looked\", and dividing by it would have put a\ncatastrophic-looking number in front of clients.\n\nSo ``accept_rate_pct`` divides by **accepted + declined** — what we actually\nknow — and ``unknown`` is reported alongside so the number can be read with\nits own confidence attached. The bucket shrinks toward zero once PR 2's\n``relation.new`` webhook lands, which is the real fix."
    },
    "OutreachStats": {
      "properties": {
        "invites": {
          "$ref": "#/$defs/InviteStats"
        },
        "replies": {
          "$ref": "#/$defs/ReplyStats"
        },
        "comments_sent": {
          "type": "integer",
          "title": "Comments Sent",
          "default": 0
        }
      },
      "type": "object",
      "title": "OutreachStats"
    },
    "ReplyStats": {
      "properties": {
        "dms_sent": {
          "type": "integer",
          "title": "Dms Sent",
          "default": 0
        },
        "emails_sent": {
          "type": "integer",
          "title": "Emails Sent",
          "default": 0
        },
        "contacted": {
          "type": "integer",
          "title": "Contacted",
          "default": 0
        },
        "replied": {
          "type": "integer",
          "title": "Replied",
          "default": 0
        },
        "reply_rate_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reply Rate Pct"
        },
        "positive": {
          "type": "integer",
          "title": "Positive",
          "default": 0
        },
        "neutral": {
          "type": "integer",
          "title": "Neutral",
          "default": 0
        },
        "negative": {
          "type": "integer",
          "title": "Negative",
          "default": 0
        },
        "unclassified": {
          "type": "integer",
          "title": "Unclassified",
          "default": 0
        },
        "silent": {
          "type": "integer",
          "title": "Silent",
          "default": 0
        }
      },
      "type": "object",
      "title": "ReplyStats",
      "description": "Messages sent and what came back.\n\n``contacted`` counts SEQUENCES (people) reached by any substantive step, not\nmessages — an invite plus two follow-ups to one lead is one person.\n``silent`` is the complement, so\npositive + neutral + negative + unclassified + silent == contacted."
    }
  }
}