{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/zuegle-com/json-schema/zuegle-com-profile-schema.json",
  "title": "Profile",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/zuegle-com-openapi.yaml#/components/schemas/Profile",
  "type": "object",
  "required": [
    "id",
    "name",
    "incomeAnnual",
    "relationship",
    "confession",
    "children",
    "currentHome"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "incomeAnnual": {
      "type": "number"
    },
    "relationship": {
      "type": "string",
      "enum": [
        "single",
        "married",
        "concubinage",
        "registered_partnership"
      ]
    },
    "confession": {
      "type": "string",
      "enum": [
        "reformed",
        "roman_catholic",
        "christ_catholic",
        "none",
        "other"
      ]
    },
    "children": {
      "type": "integer"
    },
    "currentHome": {
      "$ref": "#/$defs/CurrentHome"
    },
    "commuteTarget": {
      "type": "string"
    },
    "commuteCostMode": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "sbb",
        "car",
        "both"
      ],
      "description": "How the commute is costed. null means not chosen; consumers fall back to sbb."
    },
    "weights": {
      "$ref": "#/$defs/Weights"
    },
    "rankingObjective": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "total-cost",
        "blended",
        "tax-only",
        "per-m2"
      ],
      "description": "Which order to rank matches in. null means not chosen; the match supplies the default."
    },
    "searchRadiusKm": {
      "type": [
        "integer",
        "null"
      ],
      "description": "How far from the anchor to look for listings. null means not chosen."
    },
    "desiredRoomsMin": {
      "type": [
        "number",
        "null"
      ],
      "description": "Fewest rooms the match should consider (1-20, half-room steps). null with desiredRoomsMax also null means not chosen, and the room band then comes from the current home (±0.5). One open end is left wide rather than guessed."
    },
    "desiredRoomsMax": {
      "type": [
        "number",
        "null"
      ],
      "description": "Most rooms the match should consider. See desiredRoomsMin."
    },
    "acceptTemporary": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Whether temporary lets are acceptable. THREE states, not two: true accepts, false refuses, and null means the person was never asked. null and true behave alike today but are stored apart, so changing the default later cannot silently rewrite what an existing user appears to have chosen. A refusal only ever excludes a listing whose portal DECLARED the attribute — silence about a listing never excludes it."
    },
    "acceptSwap": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Whether apartment swaps are acceptable. Same tri-state as acceptTemporary."
    },
    "acceptSharedRoom": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Whether a room in a shared flat is acceptable. Same tri-state as acceptTemporary."
    },
    "furnishingPreference": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "furnished",
        "unfurnished"
      ],
      "description": "Furnishing requirement, or null for no preference. One tri-state rather than a fourth boolean because this is the only bidirectional one — it makes \"only furnished\" and \"not furnished\" impossible to hold at once."
    }
  },
  "$defs": {
    "CurrentHome": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "bfsId": {
          "type": [
            "integer",
            "null"
          ]
        },
        "zip": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "rooms": {
          "type": [
            "number",
            "null"
          ]
        },
        "surface": {
          "type": [
            "number",
            "null"
          ],
          "description": "Living space in m². Together with `rooms` this drives the value-for-money comparison (server/value.js). Null means unknown, never zero — an unknown component redistributes its weight rather than scoring 0."
        },
        "floor": {
          "type": [
            "number",
            "null"
          ],
          "description": "0 = ground floor. Reported and diffed, but deliberately NOT scored: a higher floor has no universally better direction."
        },
        "renovationYear": {
          "type": [
            "number",
            "null"
          ]
        },
        "balcony": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Tri-state — null means \"not stated\", which is distinct from false."
        },
        "rentNet": {
          "type": "number"
        },
        "rentCharges": {
          "type": "number"
        },
        "parking": {
          "type": "number"
        },
        "electricity": {
          "type": "number"
        },
        "extraBills": {
          "type": "number"
        },
        "commuteCostMonthly": {
          "type": [
            "number",
            "null"
          ],
          "description": "Falsy (0, null or undefined) means UNSET — only a truthy value is an explicit override that short-circuits the fare-zone auto-calc."
        },
        "commuteMinutes": {
          "type": [
            "number",
            "null"
          ]
        },
        "quality": {
          "type": "object",
          "properties": {
            "view": {
              "type": "number",
              "minimum": 0,
              "maximum": 10
            },
            "green": {
              "type": "number",
              "minimum": 0,
              "maximum": 10
            }
          }
        }
      }
    },
    "Weights": {
      "type": "object",
      "description": "Quality-score weighting; unset keys fall back to server defaults and weights are renormalized over available components.",
      "properties": {
        "commute": {
          "type": "number"
        },
        "center": {
          "type": "number"
        },
        "lake": {
          "type": "number"
        },
        "view": {
          "type": "number"
        },
        "green": {
          "type": "number"
        }
      }
    }
  }
}