{
  "id": "publisher_agreement",
  "title": "Publisher agreement status",
  "aliases": ["agreement", "MSA", "IO", "contract"],
  "description": "Whether the publisher has a signed agreement artifact on file (MSA/IO). Separate from account approval, SPAF, and banking. Phase-1 tool surface is binary only.",
  "sourceSystem": "mngt",
  "schemaTables": ["Admin.Affiliate_info"],
  "tools": ["get_publisher_agreement_status"],
  "statusFields": [
    {
      "field": "business.agreement_status",
      "description": "Phase-1 locked tool output for get_publisher_agreement_status (TW-309 / TW-313). Derived in RO view — never return Affiliate_info.agreement longtext.",
      "values": [
        {
          "value": "signed",
          "meaning": "Non-empty agreement path list and/or DocuSign envelope id recorded on Affiliate_info — treat as agreement artifact present.",
          "confirmed": true,
          "notes": "Presence only. Does not prove correct entity/product or Legal completeness; richer gates deferred past Phase 1."
        },
        {
          "value": "missing",
          "meaning": "No agreement path list and no DocuSign envelope id on Affiliate_info — publisher must not launch on agreement grounds.",
          "confirmed": true
        }
      ],
      "notes": "Locked Phase-1 values: signed | missing only. Do not return executed / wrong_or_stale from tools until a later ticket expands the contract."
    },
    {
      "field": "Admin.Affiliate_info.contract_form",
      "description": "Contract form flag on Affiliate_info (ops UI). Not part of Phase-1 tool status enum.",
      "values": [
        {
          "value": "unknown",
          "meaning": "Map tinyint codes with AdOps/Legal before confirming; optional metadata only.",
          "confirmed": false
        }
      ]
    },
    {
      "field": "Admin.Affiliate_info.docusign_envelop",
      "description": "DocuSign envelope reference if agreement was e-signed. Used only as a presence signal for signed; do not return the envelope id to ChatGPT.",
      "values": [
        {
          "value": "empty",
          "meaning": "No DocuSign envelope id recorded (may still have manual upload in agreement).",
          "confirmed": true
        },
        {
          "value": "present",
          "meaning": "Envelope id present — contributes to agreement_status=signed; do not assume DocuSign workflow complete beyond presence.",
          "confirmed": true
        }
      ]
    }
  ],
  "fieldAllowlist": [
    "Affiliate",
    "agreement_status",
    "contract_form",
    "approved",
    "company"
  ],
  "fieldDeny": [
    "agreement",
    "docusign_envelop",
    "SSN",
    "Tax_ID",
    "paypal_email",
    "pass_clr",
    "w2upload"
  ],
  "reviewStatus": "draft",
  "refs": [
    "https://admedia-jira.atlassian.net/browse/TW-285",
    "https://admedia-jira.atlassian.net/browse/TW-309",
    "https://admedia-jira.atlassian.net/browse/TW-313",
    "https://admedia-jira.atlassian.net/wiki/spaces/PM1/pages/758743051/Publisher+Onboarding+and+Launch+SOP",
    "docs/MNGT-RO-VIEWS.md"
  ],
  "notes": [
    "Affiliate_info.agreement is longtext (comma-separated upload paths / contract body pointers) — always deny; never return to ChatGPT.",
    "Phase-1 derivation (view): signed iff NULLIF(TRIM(agreement),'') IS NOT NULL OR NULLIF(TRIM(docusign_envelop),'') IS NOT NULL; else missing.",
    "onboarding_checklist.is_agreement is an ops checklist flag — not the Phase-1 source of truth for this tool.",
    "Tool returns status + safe metadata only, not agreement document contents or file paths."
  ]
}
