{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/valjeanspecialty/json-schema/valjeanspecialty-appetite-answer-schema.json",
  "title": "AppetiteAnswer",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/valjeanspecialty-openapi.yaml#/components/schemas/AppetiteAnswer",
  "type": "object",
  "properties": {
    "fit": {
      "type": "string",
      "description": "\"unknown\" means no appetite is on file for these lines yet: fall back to your own guidance.",
      "enum": [
        "good",
        "possible",
        "unlikely",
        "unknown"
      ]
    },
    "appetite_on_file": {
      "type": "boolean"
    },
    "headline": {
      "type": "string",
      "description": "One sentence you can show as is."
    },
    "market_count": {
      "type": "integer",
      "description": "Markets on file that could write it, capped at 5. Market names are never returned."
    },
    "market_count_label": {
      "type": "string",
      "description": "e.g. \"2 markets\", \"5+ markets\", \"Not on file yet\"."
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "line": {
            "type": "string",
            "description": "Line code."
          },
          "fit": {
            "type": "string",
            "enum": [
              "good",
              "possible",
              "unlikely"
            ]
          }
        },
        "required": [
          "line",
          "fit"
        ]
      }
    },
    "notes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "needs": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "What Valjean will need for this risk, in plain words."
    },
    "class_matched": {
      "type": [
        "string",
        "null"
      ],
      "description": "The class Valjean matched the risk to, if any."
    },
    "state": {
      "type": "string",
      "description": "Two-letter state code."
    },
    "unknown_lines": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Lines in the request Valjean didn't recognise."
    },
    "how_to_send": {
      "$ref": "#/$defs/HowToSend"
    }
  },
  "required": [
    "fit",
    "appetite_on_file",
    "headline",
    "market_count",
    "market_count_label",
    "lines",
    "notes",
    "needs",
    "class_matched",
    "state"
  ],
  "$defs": {
    "HowToSend": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "description": "Where to email the risk instead.",
          "format": "email"
        },
        "include": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "What to include in that email."
        },
        "note": {
          "type": "string"
        }
      },
      "required": [
        "email",
        "include",
        "note"
      ],
      "description": "Present whenever the fit isn't \"good\": a broker reviews every submission, including ones outside the appetite on file."
    }
  }
}