{
  "appName": "Recipe Book",
  "auth": {
    "multiUser": false
  },
  "startPage": "browseRecipesPage",
  "menu": [
    {
      "label": "Browse Recipes",
      "mapsTo": "browseRecipesPage"
    },
    {
      "label": "Add Recipe",
      "mapsTo": "addRecipePage"
    }
  ],
  "pages": {
    "addRecipePage": {
      "component": "page",
      "title": "Add a New Recipe",
      "content": [
        {
          "component": "text",
          "content": "Save a new recipe to your personal collection.",
          "styleHint": {
            "variant": "body"
          }
        },
        {
          "component": "form",
          "id": "addRecipeForm",
          "fields": [
            {
              "name": "recipeName",
              "label": "Recipe Name",
              "type": "text",
              "required": true,
              "placeholder": "e.g., Classic Tomato Pasta"
            },
            {
              "name": "cuisine",
              "label": "Cuisine",
              "type": "select",
              "options": [
                "Italian",
                "Asian",
                "Mexican",
                "Indian",
                "Mediterranean",
                "American",
                "French",
                "Japanese",
                "Other"
              ]
            },
            {
              "name": "servings",
              "label": "Servings",
              "type": "number"
            },
            {
              "name": "ingredients",
              "label": "Ingredients",
              "type": "multiline",
              "required": true,
              "placeholder": "List each ingredient separated by commas"
            },
            {
              "name": "instructions",
              "label": "Instructions",
              "type": "multiline",
              "required": true,
              "placeholder": "Step-by-step cooking instructions"
            },
            {
              "name": "prepTime",
              "label": "Prep Time (mins)",
              "type": "number",
              "placeholder": "e.g., 15"
            },
            {
              "name": "cookTime",
              "label": "Cook Time (mins)",
              "type": "number",
              "placeholder": "e.g., 30"
            },
            {
              "name": "dateAdded",
              "label": "Date Added",
              "type": "date",
              "default": "CURRENTDATE"
            }
          ]
        },
        {
          "component": "button",
          "label": "Save Recipe",
          "onClick": [
            {
              "action": "submit",
              "dataSource": "recipesStore",
              "target": "addRecipeForm"
            },
            {
              "action": "showMessage",
              "message": "Recipe saved!"
            },
            {
              "action": "navigate",
              "target": "browseRecipesPage"
            }
          ],
          "styleHint": {
            "emphasis": "primary",
            "icon": "save"
          }
        }
      ]
    },
    "browseRecipesPage": {
      "component": "page",
      "title": "My Recipes",
      "content": [
        {
          "component": "text",
          "content": "No recipes yet. Add your first recipe to start building your cookbook!",
          "styleHint": {
            "variant": "body",
            "align": "center",
            "color": "grey"
          },
          "visibleWhen": {
            "source": "recipesReader",
            "countEquals": 0
          }
        },
        {
          "component": "summary",
          "label": "Total Recipes",
          "value": "{COUNT(recipesReader)}",
          "icon": "restaurant",
          "styleHint": {
            "color": "orange"
          }
        },
        {
          "component": "list",
          "dataSource": "recipesReader",
          "searchable": true,
          "displayAs": "cards",
          "columns": [
            {
              "header": "Recipe",
              "field": "recipeName",
              "sortable": true
            },
            {
              "header": "Cuisine",
              "field": "cuisine",
              "sortable": true,
              "filterable": true
            },
            {
              "header": "Servings",
              "field": "servings",
              "sortable": true
            },
            {
              "header": "Added",
              "field": "dateAdded",
              "sortable": true
            }
          ],
          "defaultSort": {
            "field": "dateAdded",
            "direction": "desc"
          },
          "rowActions": [
            {
              "label": "Delete",
              "action": "delete",
              "dataSource": "recipesDeleter",
              "matchField": "_id"
            }
          ],
          "onRowTap": {
            "action": "navigate",
            "target": "editRecipePage",
            "populateForm": "editRecipeForm"
          }
        },
        {
          "component": "button",
          "label": "Add New Recipe",
          "onClick": [
            {
              "action": "navigate",
              "target": "addRecipePage"
            }
          ],
          "styleHint": {
            "emphasis": "primary",
            "icon": "add_circle"
          }
        }
      ]
    },
    "editRecipePage": {
      "component": "page",
      "title": "View / Edit Recipe",
      "content": [
        {
          "component": "form",
          "id": "editRecipeForm",
          "fields": [
            {
              "name": "recipeName",
              "label": "Recipe Name",
              "type": "text",
              "required": true
            },
            {
              "name": "cuisine",
              "label": "Cuisine",
              "type": "select",
              "options": [
                "Italian",
                "Asian",
                "Mexican",
                "Indian",
                "Mediterranean",
                "American",
                "French",
                "Japanese",
                "Other"
              ]
            },
            {
              "name": "servings",
              "label": "Servings",
              "type": "number"
            },
            {
              "name": "ingredients",
              "label": "Ingredients",
              "type": "multiline",
              "required": true
            },
            {
              "name": "instructions",
              "label": "Instructions",
              "type": "multiline",
              "required": true
            },
            {
              "name": "prepTime",
              "label": "Prep Time (mins)",
              "type": "number",
              "placeholder": "e.g., 15"
            },
            {
              "name": "cookTime",
              "label": "Cook Time (mins)",
              "type": "number",
              "placeholder": "e.g., 30"
            },
            {
              "name": "dateAdded",
              "label": "Date Added",
              "type": "date",
              "default": "CURRENTDATE"
            }
          ]
        },
        {
          "component": "button",
          "label": "Save Changes",
          "onClick": [
            {
              "action": "update",
              "dataSource": "recipesUpdater",
              "target": "editRecipeForm",
              "matchField": "_id"
            },
            {
              "action": "showMessage",
              "message": "Recipe updated!"
            },
            {
              "action": "navigate",
              "target": "browseRecipesPage"
            }
          ],
          "styleHint": {
            "emphasis": "primary",
            "icon": "save"
          }
        },
        {
          "component": "button",
          "label": "Back",
          "onClick": [
            {
              "action": "navigate",
              "target": "browseRecipesPage"
            }
          ],
          "styleHint": {
            "emphasis": "secondary",
            "icon": "arrow_back",
            "variant": "outlined"
          }
        }
      ]
    }
  },
  "dataSources": {
    "recipesStore": {
      "url": "local://recipes",
      "method": "POST",
      "ownership": {
        "enabled": true
      }
    },
    "recipesReader": {
      "url": "local://recipes",
      "method": "GET",
      "ownership": {
        "enabled": true,
        "adminOverride": true
      },
      "fields": [
        {
          "name": "recipeName",
          "type": "text"
        },
        {
          "name": "cuisine",
          "type": "select"
        },
        {
          "name": "ingredients",
          "type": "multiline"
        },
        {
          "name": "instructions",
          "type": "multiline"
        },
        {
          "name": "servings",
          "type": "number"
        },
        {
          "name": "prepTime",
          "type": "number"
        },
        {
          "name": "cookTime",
          "type": "number"
        },
        {
          "name": "dateAdded",
          "type": "date"
        }
      ],
      "seedData": [
        {
          "recipeName": "Classic Tomato Pasta",
          "cuisine": "Italian",
          "ingredients": "Spaghetti, canned tomatoes, garlic, olive oil, basil, salt, pepper",
          "instructions": "Cook pasta according to package directions. Saute garlic in olive oil, add tomatoes, simmer 15 minutes. Season with salt, pepper, and basil. Toss with drained pasta.",
          "servings": "4"
        },
        {
          "recipeName": "Simple Chicken Stir Fry",
          "cuisine": "Asian",
          "ingredients": "Chicken breast, soy sauce, bell peppers, broccoli, garlic, ginger, rice",
          "instructions": "Slice chicken and vegetables. Stir fry chicken in hot oil until cooked through. Add vegetables and cook 3 minutes. Add soy sauce, garlic, and ginger. Serve over steamed rice.",
          "servings": "2"
        }
      ]
    },
    "recipesUpdater": {
      "url": "local://recipes",
      "method": "PUT"
    },
    "recipesDeleter": {
      "url": "local://recipes",
      "method": "DELETE"
    }
  },
  "help": {
    "overview": "Recipe Book is your personal digital cookbook. Save recipes with ingredients, instructions, and serving sizes. Tap any recipe in the list to view the full details or edit it.",
    "pages": {
      "addRecipePage": "Enter recipe name, pick a cuisine, add ingredients and instructions. Press Save Recipe to add it.",
      "browseRecipesPage": "View all recipes. Tap any row to see full details and edit. Filter by cuisine. Delete recipes you no longer need.",
      "editRecipePage": "View and edit the full recipe including ingredients and instructions. Press Save Changes when done."
    }
  },
  "settings": {
    "defaultServings": {
      "label": "Default servings",
      "type": "number",
      "default": "4"
    },
    "defaultCuisine": {
      "label": "Default cuisine",
      "type": "select",
      "options": [
        "Italian",
        "Asian",
        "Mexican",
        "Indian",
        "Mediterranean",
        "American",
        "French",
        "Japanese",
        "Other"
      ],
      "default": "Italian"
    }
  },
  "tour": [
    {
      "title": "Welcome to Recipe Book",
      "content": "Build your personal recipe collection right on your device."
    },
    {
      "title": "Add Your Recipes",
      "content": "Enter a recipe name, pick a cuisine, then add ingredients and instructions. Fields marked with * are required.",
      "page": "addRecipePage"
    },
    {
      "title": "Browse Your Collection",
      "content": "All recipes appear here. Tap any row to see the full recipe with ingredients and instructions. Filter by cuisine.",
      "page": "browseRecipesPage"
    }
  ],
  "theme": {
    "base": "valentine"
  }
}
