{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/capepartners-fr/json-schema/capepartners-fr-pairings-response-schema.json",
  "title": "PairingsResponse",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/capepartners-fr-pairings-api-openapi.yml#/components/schemas/PairingsResponse",
  "type": "object",
  "properties": {
    "role": {
      "type": "string",
      "enum": [
        "buyer",
        "seller"
      ]
    },
    "buyer_id": {
      "type": "integer"
    },
    "seller_id": {
      "type": "integer"
    },
    "buyer_name": {
      "type": "string"
    },
    "seller_name": {
      "type": "string"
    },
    "pairings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Pairing"
      }
    },
    "count": {
      "type": "integer"
    }
  },
  "$defs": {
    "Pairing": {
      "type": "object",
      "properties": {
        "pair_id": {
          "type": "string"
        },
        "buyer_id": {
          "type": "integer"
        },
        "seller_id": {
          "type": "integer"
        },
        "match_score": {
          "type": "number",
          "format": "float"
        },
        "phase": {
          "type": "string"
        },
        "valuation": {
          "type": "number",
          "format": "float"
        },
        "valuation_triangulated": {
          "type": "number",
          "format": "float"
        },
        "updated_at": {
          "type": "string"
        },
        "buyer_name": {
          "type": "string"
        },
        "seller_name": {
          "type": "string"
        },
        "buyer_sector": {
          "type": "string"
        },
        "seller_sector": {
          "type": "string"
        },
        "seller_revenue": {
          "type": "number"
        },
        "seller_growth": {
          "type": "number"
        },
        "seller_ebitda": {
          "type": "number"
        },
        "seller_product": {
          "type": "string"
        },
        "seller_contact_name": {
          "type": "string"
        },
        "seller_contact_email": {
          "type": "string"
        },
        "seller_data_quality": {
          "type": "integer"
        },
        "buyer_ticket_min": {
          "type": "number"
        },
        "buyer_ticket_max": {
          "type": "number"
        },
        "pairing_dbid": {
          "type": "integer"
        },
        "phase_request": {
          "$ref": "#/$defs/PendingPhaseRequest"
        }
      }
    },
    "PendingPhaseRequest": {
      "type": [
        "object",
        "null"
      ],
      "description": "A live phase-change request on this pairing (mutual consent). While it exists the pairing is LOCKED: the phase stays visible but no phase change is accepted until the counterparty answers. Absent/null when nothing is pending.",
      "properties": {
        "request_id": {
          "type": "integer"
        },
        "from_phase": {
          "type": "string"
        },
        "to_phase": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "expires_at": {
          "type": "string",
          "description": "UTC timestamp at which the request lapses automatically (lazy expiry, default TTL 14 days, configurable via CONSENT_REQUEST_TTL_DAYS)."
        },
        "ttl_days": {
          "type": "integer"
        },
        "requested_by": {
          "type": "string",
          "enum": [
            "me",
            "counterparty"
          ],
          "description": "'counterparty' = this session must confirm or dismiss it; 'me' = this session raised it and is waiting (it may cancel)."
        },
        "requested_by_side": {
          "type": "string",
          "enum": [
            "buyer",
            "seller"
          ]
        }
      }
    }
  }
}