{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://calligence.ai/docs/webhooks/schemas/whatsapp.message.media_processed/v1.json",
  "title": "whatsapp.message.media_processed",
  "description": "Cuando terminamos de procesar un adjunto recibido (por ejemplo, la transcripción de una nota de voz). Un adjunto que no llega a procesarse no lo emite. Una vez por adjunto.",
  "$defs": {
    "CampaignRef": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "integer"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "title": "CampaignRef",
      "type": "object"
    },
    "CustomerRef": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "integer"
        },
        "external_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "External Id"
        },
        "phone": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Phone"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name"
        }
      },
      "required": [
        "id",
        "external_id",
        "phone",
        "name"
      ],
      "title": "CustomerRef",
      "type": "object"
    },
    "LeadRef": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "integer"
        },
        "status": {
          "examples": [
            "PENDIENTE",
            "EXITO",
            "INVALIDO",
            "NO_INTERESADO",
            "TRABAJADO_EXTERNO"
          ],
          "type": "string",
          "title": "Status"
        },
        "status_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Status Reason"
        },
        "product_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Product Name"
        },
        "product_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Product Code"
        }
      },
      "required": [
        "id",
        "status",
        "status_reason",
        "product_name",
        "product_code"
      ],
      "title": "LeadRef",
      "type": "object"
    },
    "MessageId": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "integer"
        }
      },
      "required": [
        "id"
      ],
      "title": "MessageId",
      "type": "object"
    },
    "ProcessedMedia": {
      "properties": {
        "kind": {
          "examples": [
            "audio",
            "image",
            "media"
          ],
          "type": "string",
          "title": "Kind"
        },
        "content_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Content Type"
        },
        "status": {
          "examples": [
            "done",
            "failed",
            "too_large",
            "unsupported",
            "disabled"
          ],
          "type": "string",
          "title": "Status"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text"
        }
      },
      "required": [
        "kind",
        "content_type",
        "status",
        "text"
      ],
      "title": "ProcessedMedia",
      "type": "object"
    }
  },
  "properties": {
    "customer": {
      "anyOf": [
        {
          "$ref": "#/$defs/CustomerRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "lead": {
      "anyOf": [
        {
          "$ref": "#/$defs/LeadRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "campaign": {
      "anyOf": [
        {
          "$ref": "#/$defs/CampaignRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "message": {
      "$ref": "#/$defs/MessageId"
    },
    "media": {
      "$ref": "#/$defs/ProcessedMedia"
    }
  },
  "required": [
    "customer",
    "lead",
    "campaign",
    "message",
    "media"
  ],
  "type": "object"
}
