{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://getpreparedstuff.com/tracker-export-schema.json",
  "title": "GetPreparedStuff tracker export, version 1",
  "type": "object",
  "required": [
    "kind",
    "version",
    "profile",
    "inventory"
  ],
  "properties": {
    "kind": {
      "const": "getpreparedstuff-tracker"
    },
    "version": {
      "const": 1
    },
    "exportedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "profile": {
      "type": "object",
      "required": [
        "adults",
        "children",
        "targetTier"
      ],
      "properties": {
        "adults": {
          "type": "integer",
          "minimum": 0
        },
        "children": {
          "type": "integer",
          "minimum": 0
        },
        "babies": {
          "type": "integer",
          "minimum": 0
        },
        "dogs": {
          "type": "integer",
          "minimum": 0
        },
        "cats": {
          "type": "integer",
          "minimum": 0
        },
        "medUsers": {
          "type": "integer",
          "minimum": 0
        },
        "targetTier": {
          "enum": [
            "tonight",
            "h72",
            "wk2",
            "mo1",
            "mo3"
          ]
        },
        "housing": {
          "enum": [
            "own",
            "rent"
          ]
        }
      }
    },
    "inventory": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "category",
          "quantity"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "itemId": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "category": {
            "type": "string",
            "minLength": 1
          },
          "quantity": {
            "type": "number",
            "minimum": 0
          },
          "unit": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "purchased": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "expires": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "custom": {
            "type": "boolean"
          },
          "countsToward": {
            "type": [
              "string",
              "null"
            ]
          },
          "countsFactor": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0
          },
          "notes": {
            "type": "string"
          },
          "selfFilled": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      }
    }
  }
}