{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/getmyluna-app/json-schema/getmyluna-app-profile-schema.json",
  "title": "Profile",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/getmyluna-app-openapi.json#/components/schemas/Profile",
  "properties": {
    "baby_name": {
      "type": "string",
      "title": "Baby Name"
    },
    "dob": {
      "type": "string",
      "title": "Dob",
      "description": "YYYY-MM-DD, or empty while the family is expecting (see `due_date`)."
    },
    "gender": {
      "type": "string",
      "title": "Gender",
      "default": ""
    },
    "family_name": {
      "type": "string",
      "title": "Family Name",
      "default": ""
    },
    "timezone": {
      "type": "string",
      "title": "Timezone",
      "description": "IANA zone.",
      "default": "Europe/London"
    },
    "region": {
      "type": "string",
      "enum": [
        "uk",
        "us",
        "za"
      ],
      "title": "Region",
      "default": "uk"
    },
    "units": {
      "type": "string",
      "enum": [
        "metric",
        "imperial"
      ],
      "title": "Units",
      "default": "metric"
    },
    "age_months": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Age Months"
    },
    "age_display": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Age Display"
    },
    "solids_started": {
      "type": "boolean",
      "title": "Solids Started",
      "default": false
    },
    "member_count": {
      "type": "integer",
      "title": "Member Count",
      "default": 1
    },
    "age_band_targets": {
      "additionalProperties": true,
      "type": "object",
      "title": "Age Band Targets"
    },
    "due_date": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Due Date",
      "description": "YYYY-MM-DD while expecting; null once the date of birth is set."
    },
    "expecting": {
      "anyOf": [
        {
          "$ref": "#/$defs/Expecting"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "baby_name",
    "dob"
  ],
  "$defs": {
    "Expecting": {
      "properties": {
        "due_date": {
          "type": "string",
          "title": "Due Date"
        },
        "days_until_due": {
          "type": "integer",
          "title": "Days Until Due",
          "description": "0 once the due date arrives."
        },
        "due_date_reached": {
          "type": "boolean",
          "title": "Due Date Reached"
        },
        "days_overdue": {
          "type": "integer",
          "title": "Days Overdue",
          "description": "Days since the due date while the birth isn't confirmed yet (0 before it). The family stays expecting until a caregiver confirms the arrival.",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "due_date",
        "days_until_due",
        "due_date_reached"
      ],
      "title": "Expecting",
      "description": "Set while the baby isn't born yet: there is no age and no age-based target."
    }
  }
}