{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nudgelink-co/json-schema/nudgelink-co-admin-overview-schema.json",
  "title": "AdminOverview",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nudgelink-co-openapi.json#/components/schemas/AdminOverview",
  "properties": {
    "total_clients": {
      "type": "integer",
      "title": "Total Clients"
    },
    "paying_subscriptions": {
      "type": "integer",
      "title": "Paying Subscriptions"
    },
    "active_pilots": {
      "type": "integer",
      "title": "Active Pilots"
    },
    "comped_plans": {
      "type": "integer",
      "title": "Comped Plans"
    },
    "new_signups_7d": {
      "type": "integer",
      "title": "New Signups 7D"
    },
    "mrr_30d_usd": {
      "type": "number",
      "title": "Mrr 30D Usd"
    },
    "ai_cost_30d_usd": {
      "type": "number",
      "title": "Ai Cost 30D Usd"
    },
    "active_sequences": {
      "type": "integer",
      "title": "Active Sequences"
    },
    "stalled_sequences": {
      "type": "integer",
      "title": "Stalled Sequences"
    },
    "unhealthy_accounts": {
      "type": "integer",
      "title": "Unhealthy Accounts"
    },
    "pilots_expiring_7d": {
      "type": "integer",
      "title": "Pilots Expiring 7D"
    },
    "out_of_credit_clients": {
      "type": "integer",
      "title": "Out Of Credit Clients"
    },
    "admin_actions_7d": {
      "type": "integer",
      "title": "Admin Actions 7D"
    },
    "pilots_expiring_sample": {
      "items": {
        "$ref": "#/$defs/OverviewPilotExpiring"
      },
      "type": "array",
      "title": "Pilots Expiring Sample"
    },
    "out_of_credit_sample": {
      "items": {
        "$ref": "#/$defs/OverviewOutOfCredit"
      },
      "type": "array",
      "title": "Out Of Credit Sample"
    },
    "real_clients": {
      "type": "integer",
      "title": "Real Clients",
      "default": 0
    },
    "new_real_signups_7d": {
      "type": "integer",
      "title": "New Real Signups 7D",
      "default": 0
    },
    "replies_waiting_24h": {
      "type": "integer",
      "title": "Replies Waiting 24H",
      "default": 0
    },
    "replies_waiting_sample": {
      "items": {
        "$ref": "#/$defs/OverviewWaitingReply"
      },
      "type": "array",
      "title": "Replies Waiting Sample",
      "default": []
    },
    "outreach": {
      "$ref": "#/$defs/OutreachStats"
    }
  },
  "type": "object",
  "required": [
    "total_clients",
    "paying_subscriptions",
    "active_pilots",
    "comped_plans",
    "new_signups_7d",
    "mrr_30d_usd",
    "ai_cost_30d_usd",
    "active_sequences",
    "stalled_sequences",
    "unhealthy_accounts",
    "pilots_expiring_7d",
    "out_of_credit_clients",
    "admin_actions_7d",
    "pilots_expiring_sample",
    "out_of_credit_sample",
    "outreach"
  ],
  "$defs": {
    "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"
    },
    "OverviewOutOfCredit": {
      "properties": {
        "client_id": {
          "type": "string",
          "format": "uuid",
          "title": "Client Id"
        },
        "email": {
          "type": "string",
          "title": "Email"
        },
        "company_name": {
          "type": "string",
          "title": "Company Name"
        },
        "credits_balance": {
          "type": "integer",
          "title": "Credits Balance"
        },
        "subscription_plan": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Subscription Plan"
        }
      },
      "type": "object",
      "required": [
        "client_id",
        "email",
        "company_name",
        "credits_balance",
        "subscription_plan"
      ],
      "title": "OverviewOutOfCredit"
    },
    "OverviewPilotExpiring": {
      "properties": {
        "client_id": {
          "type": "string",
          "format": "uuid",
          "title": "Client Id"
        },
        "email": {
          "type": "string",
          "title": "Email"
        },
        "company_name": {
          "type": "string",
          "title": "Company Name"
        },
        "pilot_expires_at": {
          "type": "string",
          "format": "date-time",
          "title": "Pilot Expires At"
        },
        "days_left": {
          "type": "integer",
          "title": "Days Left"
        }
      },
      "type": "object",
      "required": [
        "client_id",
        "email",
        "company_name",
        "pilot_expires_at",
        "days_left"
      ],
      "title": "OverviewPilotExpiring"
    },
    "OverviewWaitingReply": {
      "properties": {
        "client_id": {
          "type": "string",
          "format": "uuid",
          "title": "Client Id"
        },
        "client_email": {
          "type": "string",
          "title": "Client Email"
        },
        "company_name": {
          "type": "string",
          "title": "Company Name"
        },
        "lead_id": {
          "type": "string",
          "format": "uuid",
          "title": "Lead Id"
        },
        "lead_name": {
          "type": "string",
          "title": "Lead Name"
        },
        "sequence_id": {
          "type": "string",
          "format": "uuid",
          "title": "Sequence Id"
        },
        "classification": {
          "type": "string",
          "title": "Classification"
        },
        "received_at": {
          "type": "string",
          "format": "date-time",
          "title": "Received At"
        },
        "hours_waiting": {
          "type": "integer",
          "title": "Hours Waiting"
        }
      },
      "type": "object",
      "required": [
        "client_id",
        "client_email",
        "company_name",
        "lead_id",
        "lead_name",
        "sequence_id",
        "classification",
        "received_at",
        "hours_waiting"
      ],
      "title": "OverviewWaitingReply",
      "description": "LRU ADM-2: a positive/question reply 24 h+ old with no answer sent from NudgeLink."
    },
    "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."
    }
  }
}