{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/intencheck-com/json-schema/intencheck-com-reply-request-schema.json",
  "title": "ReplyRequest",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/intencheck-com-openapi.json#/components/schemas/ReplyRequest",
  "properties": {
    "original_text": {
      "type": "string",
      "minLength": 1,
      "title": "Original Text",
      "description": "Source text that should be answered or rewritten. The request is billed by this text's word count."
    },
    "analysis_data": {
      "$ref": "#/$defs/CompactAnalysisResult-Input",
      "description": "Analysis result for the original text. Usually pass the output from analyze_text so the reply generator can align tone, emotion, and style."
    },
    "strategy": {
      "type": "string",
      "enum": [
        "analogous",
        "opposite",
        "analogous_plus_vector",
        "custom"
      ],
      "title": "Strategy",
      "description": "Reply strategy. 'analogous' mirrors the detected style, 'opposite' counterbalances it, 'analogous_plus_vector' follows vector_instructions, and 'custom' follows custom_parameters."
    },
    "mode": {
      "type": "string",
      "enum": [
        "reply",
        "rewrite"
      ],
      "title": "Mode",
      "description": "'reply' generates an answer; 'rewrite' rewrites the original text.",
      "default": "reply"
    },
    "vector_instructions": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Vector Instructions",
      "description": "Additional direction used only with strategy='analogous_plus_vector'."
    },
    "custom_parameters": {
      "anyOf": [
        {
          "$ref": "#/$defs/CustomParameters"
        },
        {
          "type": "null"
        }
      ],
      "description": "Target tone, mood, style, or metaprogram settings used only with strategy='custom'."
    },
    "target_language": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Target Language",
      "description": "Optional ISO 639-1 output language. If omitted, the generated text uses the source text's language."
    }
  },
  "type": "object",
  "required": [
    "original_text",
    "analysis_data",
    "strategy"
  ],
  "$defs": {
    "CompactAnalysisResult-Input": {
      "properties": {
        "mp": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompactMetaprograms"
            },
            {
              "type": "null"
            }
          ]
        },
        "e": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompactEmotions"
            },
            {
              "type": "null"
            }
          ]
        },
        "m": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompactMoods"
            },
            {
              "type": "null"
            }
          ]
        },
        "cs": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompactCommunicationStyles"
            },
            {
              "type": "null"
            }
          ]
        },
        "tp": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompactToneAndPosture"
            },
            {
              "type": "null"
            }
          ]
        },
        "s": {
          "anyOf": [
            {
              "$ref": "#/$defs/SentimentResult"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "title": "CompactAnalysisResult"
    },
    "CompactCommunicationStyles": {
      "properties": {
        "ws": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Warm / Supportive"
        },
        "cd": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Cold / Distant"
        },
        "as": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Assertive"
        },
        "agg": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Aggressive"
        },
        "ps": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Passive"
        },
        "pag": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Passive-Aggressive"
        },
        "cdom": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Controlling / Dominant"
        },
        "aa": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Accommodating / Adaptive"
        }
      },
      "type": "object",
      "required": [
        "ws",
        "cd",
        "as",
        "agg",
        "ps",
        "pag",
        "cdom",
        "aa"
      ],
      "title": "CompactCommunicationStyles"
    },
    "CompactEmotions": {
      "properties": {
        "js": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Joy / Satisfaction"
        },
        "cr": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Calm / Relaxation"
        },
        "ic": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Interest / Curiosity"
        },
        "sc": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Surprise / Confusion"
        },
        "sd": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Sadness / Disappointment"
        },
        "aif": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Anger / Irritation / Frustration"
        },
        "fat": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Fear / Anxiety / Tension"
        },
        "sga": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Shame / Guilt / Awkwardness"
        },
        "dc": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Disgust / Contempt"
        },
        "er": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Envy / Resentment"
        }
      },
      "type": "object",
      "required": [
        "js",
        "cr",
        "ic",
        "sc",
        "sd",
        "aif",
        "fat",
        "sga",
        "dc",
        "er"
      ],
      "title": "CompactEmotions"
    },
    "CompactMetaprogramPair": {
      "properties": {
        "ls": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ls",
          "description": "Left side score"
        },
        "rs": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rs",
          "description": "Right side score"
        },
        "d": {
          "type": "boolean",
          "title": "D",
          "default": true
        }
      },
      "type": "object",
      "title": "CompactMetaprogramPair"
    },
    "CompactMetaprograms": {
      "properties": {
        "ta": {
          "$ref": "#/$defs/CompactMetaprogramPair",
          "description": "Toward vs Away"
        },
        "ie": {
          "$ref": "#/$defs/CompactMetaprogramPair",
          "description": "Internal vs External"
        },
        "mm": {
          "$ref": "#/$defs/CompactMetaprogramPair",
          "description": "Matching vs Mismatching"
        },
        "gs": {
          "$ref": "#/$defs/CompactMetaprogramPair",
          "description": "Global vs Specific"
        },
        "op": {
          "$ref": "#/$defs/CompactMetaprogramPair",
          "description": "Options vs Procedures"
        },
        "pn": {
          "$ref": "#/$defs/CompactMetaprogramPair",
          "description": "Possibility vs Necessity"
        },
        "pr": {
          "$ref": "#/$defs/CompactMetaprogramPair",
          "description": "Proactive vs Reactive"
        }
      },
      "type": "object",
      "required": [
        "ta",
        "ie",
        "mm",
        "gs",
        "op",
        "pn",
        "pr"
      ],
      "title": "CompactMetaprograms"
    },
    "CompactMoods": {
      "properties": {
        "up": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Uplifted / Playful"
        },
        "cn": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Calm / Neutral"
        },
        "irr": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Irritable"
        },
        "gd": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Gloomy / Depressed"
        },
        "wt": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Worried / Tense"
        },
        "cs": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Cynical / Skeptical"
        },
        "ei": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Enthusiastic / Inspired"
        },
        "ta": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Tired / Apathetic"
        }
      },
      "type": "object",
      "required": [
        "up",
        "cn",
        "irr",
        "gd",
        "wt",
        "cs",
        "ei",
        "ta"
      ],
      "title": "CompactMoods"
    },
    "CompactParameterScore": {
      "properties": {
        "v": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "V",
          "description": "Score 1-10"
        },
        "d": {
          "type": "boolean",
          "title": "D",
          "description": "Detected",
          "default": true
        }
      },
      "type": "object",
      "title": "CompactParameterScore"
    },
    "CompactToneAndPosture": {
      "properties": {
        "gn": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Gentle"
        },
        "neu": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Neutral"
        },
        "hd": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Hard"
        },
        "ang": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Angry"
        },
        "mo": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Mocking"
        },
        "sar": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Sarcastic"
        },
        "iro": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Ironic"
        },
        "pat": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Patronizing"
        },
        "ac": {
          "$ref": "#/$defs/CompactParameterScore",
          "description": "Affectionate / Caring"
        }
      },
      "type": "object",
      "required": [
        "gn",
        "neu",
        "hd",
        "ang",
        "mo",
        "sar",
        "iro",
        "pat",
        "ac"
      ],
      "title": "CompactToneAndPosture"
    },
    "CustomParameters": {
      "properties": {
        "target_tone": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Target Tone",
          "description": "Desired tone for the generated reply or rewrite."
        },
        "target_mood": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Target Mood",
          "description": "Desired emotional mood for the generated reply or rewrite."
        },
        "target_communication_style": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Target Communication Style",
          "description": "Desired communication style, such as assertive, warm, neutral, or diplomatic."
        },
        "metaprograms": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Metaprograms",
          "description": "Optional target metaprogram adjustments keyed by metaprogram name."
        }
      },
      "type": "object",
      "title": "CustomParameters"
    },
    "SentimentResult": {
      "properties": {
        "sentiment": {
          "type": "string",
          "title": "Sentiment",
          "description": "Overall sentiment (Positive, Negative, Neutral)"
        },
        "score": {
          "type": "integer",
          "title": "Score",
          "description": "Score from 1 (very negative) to 10 (very positive)"
        },
        "explanation": {
          "type": "string",
          "title": "Explanation",
          "description": "Brief explanation of the sentiment"
        }
      },
      "type": "object",
      "required": [
        "sentiment",
        "score",
        "explanation"
      ],
      "title": "SentimentResult"
    }
  }
}