{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bamf-ai/json-schema/bamf-ai-profile-snapshot-ingest-request-schema.json",
  "title": "ProfileSnapshotIngestRequest",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bamf-ai-openapi.json#/components/schemas/ProfileSnapshotIngestRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "creator_id",
    "source_profile_url",
    "captured_at",
    "validation_status",
    "is_pre_bamf_capture",
    "is_original_baseline",
    "profile",
    "assets",
    "missing",
    "provenance"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Exact immutable source snapshot UUID; also serves as record-level idempotency identity."
    },
    "creator_id": {
      "type": "string",
      "format": "uuid"
    },
    "source_profile_url": {
      "type": "string",
      "format": "uri",
      "description": "HTTPS LinkedIn /in/ profile URL."
    },
    "captured_at": {
      "type": "string",
      "format": "date-time"
    },
    "validation_status": {
      "type": "string",
      "enum": [
        "pending",
        "partial",
        "verified",
        "failed"
      ]
    },
    "is_pre_bamf_capture": {
      "type": "boolean"
    },
    "is_original_baseline": {
      "type": "boolean",
      "description": "Allowed only when validation_status is verified and is_pre_bamf_capture is true."
    },
    "supersedes_snapshot_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "profile": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 240
        },
        "headline": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 500
        },
        "about": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 12000
        },
        "location": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 500
        },
        "profile_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "featured": {
          "type": "array",
          "maxItems": 6,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "title": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 500
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 2000
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              }
            }
          }
        }
      }
    },
    "assets": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "full_page_screenshot": {
          "anyOf": [
            {
              "$ref": "#/$defs/ProfileSnapshotAsset"
            },
            {
              "type": "null"
            }
          ]
        },
        "photo": {
          "anyOf": [
            {
              "$ref": "#/$defs/ProfileSnapshotAsset"
            },
            {
              "type": "null"
            }
          ]
        },
        "banner": {
          "anyOf": [
            {
              "$ref": "#/$defs/ProfileSnapshotAsset"
            },
            {
              "type": "null"
            }
          ]
        },
        "featured": {
          "type": "array",
          "maxItems": 6,
          "items": {
            "$ref": "#/$defs/ProfileSnapshotAsset"
          }
        }
      }
    },
    "missing": {
      "type": "array",
      "maxItems": 20,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "field",
          "reason"
        ],
        "properties": {
          "field": {
            "type": "string",
            "maxLength": 80
          },
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        }
      }
    },
    "provenance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "capture_method",
        "source_system",
        "source_record_id"
      ],
      "properties": {
        "capture_method": {
          "type": "string",
          "enum": [
            "governed_browser",
            "api",
            "import"
          ]
        },
        "source_system": {
          "type": "string",
          "maxLength": 120
        },
        "source_record_id": {
          "type": "string",
          "maxLength": 240
        },
        "source_content_hash": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[0-9a-fA-F]{64}$",
          "description": "Source system's immutable custody hash. This is distinct from BAMF.ai's canonical content_hash."
        },
        "source_snapshot_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "capture_receipt_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "capture_job_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "visible_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "evidence_refs": {
          "type": "array",
          "maxItems": 12,
          "items": {
            "type": "string",
            "maxLength": 500
          }
        },
        "notes": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 1000
        }
      }
    },
    "content_hash": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[0-9a-fA-F]{64}$",
      "description": "Optional expected BAMF.ai canonical hash. Omit on first handoff and persist the returned hash for receipts."
    }
  },
  "$defs": {
    "ProfileSnapshotAsset": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "asset_id",
        "mime_type",
        "size_bytes",
        "sha256",
        "localization_status"
      ],
      "properties": {
        "asset_id": {
          "type": "string",
          "maxLength": 160
        },
        "storage_bucket": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 160,
          "description": "Optional durable bucket identifier. Omit for private cross-system storage."
        },
        "storage_path": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 1000,
          "description": "Optional relative object path. Signed URLs and credentials are forbidden."
        },
        "mime_type": {
          "type": "string",
          "enum": [
            "image/png",
            "image/jpeg",
            "image/webp"
          ]
        },
        "size_bytes": {
          "type": "integer",
          "minimum": 1,
          "maximum": 52428800
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{64}$"
        },
        "source_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Credential-free public HTTPS URL; query and fragment are discarded."
        },
        "captured_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "localization_status": {
          "type": "string",
          "enum": [
            "localized",
            "external",
            "missing"
          ]
        }
      }
    }
  }
}