{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/prosp-cc/json-schema/prosp-cc-message-generation-request-schema.json",
  "title": "MessageGenerationRequest",
  "description": "What to write, to whom, from whom. There is NO language field: the message language is the language of the recipient company's website main page, reported on the result. If sender is omitted, the caller's seller profile website is the sender; the profile's offering and description are used as sender facts. If sender.company_domain differs from the profile website, the profile is not used.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/prosp-cc-openapi.yaml#/components/schemas/MessageGenerationRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "recipient",
    "channel",
    "objective"
  ],
  "properties": {
    "recipient": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "company_domain"
      ],
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 200,
          "description": "The person's name, as the caller knows it."
        },
        "role": {
          "type": "string",
          "maxLength": 200,
          "description": "The person's role at the company."
        },
        "company_domain": {
          "type": "string",
          "pattern": "^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+([a-z]{2,63}|xn--[a-z0-9-]{1,59})$",
          "description": "Lowercase hostname (internationalised names in punycode); no scheme, path or port."
        }
      }
    },
    "sender": {
      "type": "object",
      "additionalProperties": false,
      "description": "The sender's own company domain. The service reads the sender's facts from the knowledge base by it; ownership is not verified. If sender is omitted, the caller's seller profile website is the sender; the profile's offering and description are used as sender facts. If sender.company_domain differs from the profile website, the profile is not used.",
      "properties": {
        "company_domain": {
          "type": "string",
          "pattern": "^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+([a-z]{2,63}|xn--[a-z0-9-]{1,59})$",
          "description": "Lowercase hostname (internationalised names in punycode); no scheme, path or port."
        }
      }
    },
    "channel": {
      "type": "string",
      "enum": [
        "email",
        "whatsapp",
        "telegram"
      ]
    },
    "objective": {
      "type": "string",
      "maxLength": 1000,
      "description": "What the message should achieve, in the caller's words."
    },
    "constraints": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "max_characters": {
          "type": "integer",
          "minimum": 1,
          "description": "Bounds the message text only. The email subject has its own fixed cap of 80 characters and is not counted against this limit."
        },
        "tone": {
          "type": "string",
          "maxLength": 64
        }
      }
    },
    "callback_url": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048,
      "pattern": "^https://",
      "description": "RESERVED. Accepted and stored, but no callback is delivered yet; poll the status resource. Must be an `https` URL on a public host: private, loopback, link-local, reserved, multicast and cloud-metadata addresses are rejected with `422 unsafe_url` (same rule as `odoo_url` on the tenant Odoo endpoint)."
    }
  }
}