{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:folio:1:customFoods",
  "title": "customFoods.json",
  "description": "The cook's own foods, numbers per 100 g. Only in full exports.",
  "type": "array",
  "items": {
    "type": "object",
    "required": [
      "id",
      "name",
      "aisle",
      "kcal",
      "protein",
      "carbs",
      "fat",
      "createdAt",
      "updatedAt"
    ],
    "properties": {
      "id": {
        "type": "string",
        "pattern": "^custom-.+"
      },
      "name": {
        "type": "string",
        "minLength": 1
      },
      "aisle": {
        "type": "string",
        "minLength": 1,
        "description": "Produce, Bakery, Meat & fish, Dairy & eggs, Grains & pasta, Tins & jars, Baking, Spices & oils, Frozen, Drinks or Other. Any other name is kept and listed after Drinks, alphabetically."
      },
      "kcal": {
        "type": "number",
        "minimum": 0,
        "maximum": 900
      },
      "protein": {
        "type": "number",
        "minimum": 0,
        "maximum": 100
      },
      "carbs": {
        "type": "number",
        "minimum": 0,
        "maximum": 100
      },
      "fat": {
        "type": "number",
        "minimum": 0,
        "maximum": 100
      },
      "createdAt": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?Z$",
        "description": "ISO 8601 in UTC with a Z, seconds required, fractions of a second optional (up to 9 digits): 2026-11-08T12:00:00Z."
      },
      "updatedAt": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?Z$",
        "description": "ISO 8601 in UTC with a Z, seconds required, fractions of a second optional (up to 9 digits): 2026-11-08T12:00:00Z."
      },
      "barcode": {
        "type": [
          "string",
          "null"
        ],
        "pattern": "^\\d{8,14}$",
        "description": "Normalised (Docs/Milestone14.md §2)."
      },
      "brand": {
        "type": [
          "string",
          "null"
        ]
      },
      "source": {
        "anyOf": [
          {
            "enum": [
              "openfoodfacts"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "servingG": {
        "type": [
          "number",
          "null"
        ],
        "exclusiveMinimum": 0,
        "maximum": 1000
      },
      "eachG": {
        "type": [
          "number",
          "null"
        ],
        "exclusiveMinimum": 0,
        "maximum": 1000
      },
      "packG": {
        "type": [
          "number",
          "null"
        ],
        "exclusiveMinimum": 0,
        "maximum": 1000
      },
      "missingMacros": {
        "type": "boolean"
      }
    }
  }
}
