{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/getmyluna-app/json-schema/getmyluna-app-live-status-schema.json",
  "title": "LiveStatus",
  "description": "Current state derived from the log. Additional keys may appear; the ones below are stable.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/getmyluna-app-openapi.json#/components/schemas/LiveStatus",
  "properties": {
    "now": {
      "type": "string",
      "title": "Now"
    },
    "asleep": {
      "type": "boolean",
      "title": "Asleep"
    },
    "night_sleep": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Night Sleep"
    },
    "awake_minutes": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Awake Minutes"
    },
    "alert_level": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Alert Level"
    },
    "alert_msg": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Alert Msg"
    },
    "hungry_state": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Hungry State",
      "description": "e.g. `not_yet`, `hungry_soon`, `overdue`, `dream_feed`, `unknown`."
    },
    "next_feed_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Feed At"
    },
    "last_milk_ml": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Milk Ml"
    },
    "ml_today": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ml Today"
    },
    "feeds_today": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Feeds Today"
    },
    "last_poop_hours_ago": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Poop Hours Ago"
    },
    "poop_status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Poop Status"
    },
    "expected_bedtime_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expected Bedtime At"
    },
    "next_nap_window_at": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Nap Window At"
    },
    "daily_milk_target_ml": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Daily Milk Target Ml"
    },
    "supplement_log": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Supplement Log"
    },
    "age_months": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Age Months",
      "description": "Null while the family is expecting."
    },
    "expecting": {
      "anyOf": [
        {
          "$ref": "#/$defs/Expecting"
        },
        {
          "type": "null"
        }
      ],
      "description": "Set while the baby isn't born yet."
    }
  },
  "type": "object",
  "required": [
    "now",
    "asleep"
  ],
  "$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."
    }
  }
}