# Generate Simple Meal Plan

The `generateSimpleMealPlan` mutation generates a 7-days meal plan that complies with the user's program and preferences.

### How the Simple Meal Plan works

The `generateSimpleMealPlan` includes default values, for example, each day has breakfast,  lunch,  dinner, and a single snack, with a daily caloric goal of 2000 kcal.

#### Use Filters

Use [filters](https://docs.suggestic.com/graphql/query/mutations/meal-plan/generate-simple-meal-plan#available-arguments) if what you need is to generate a meal plan with recipes that contain a specific caloric range or tags per mealtime.

#### Lock the meal plan

By default, `generateSimpleMealPlan` locks the meal plan to stop the user from generating a new meal plan if one is *in progress*. In other words, a user can't generate a new meal plan if the current one still has dates in the future.

If you need more control over these settings, please review the [Generate Meal Plan](/graphql/query/mutations/meal-plan/generate-meal-plan.md) mutation.

#### Manage Rules&#x20;

The `generateSimpleMealPlan` inlcudes an option to increase or decrease rules depending on the rules defined in a [program](https://docs.suggestic.com/console/access-the-main-menu/access-the-main-menu/programs/programs/manage-rules#creating-a-rule).

#### Allow repetitions in the meal plan

Generate a meal plan more consistently to simplify shopping by defining the `variety` argument to specify the number of repetitions per meal.&#x20;

There are 3 levels of variety:

* `LOW:` Generate three different meals in the week. For example, the meal plan generates three breakfasts, three lunches, three dinners, and three snacks distributed across the week.&#x20;
* `MEDIUM:` Generate 5 different meals in the week.
* `HIGH:` All generated meals are different. This is the current behavior of the meal plan.

This is not a required argument, so if it is not defined, the `high` variety is set as default.

#### Considerations

* If it is required to set the [user's meal plan settings](https://docs.suggestic.com/graphql/query/mutations/user-profile/profile-meal-plan-settings) with a custom format such as `[BREAKFAST, SNACK, LUNCH, SNACK, DINNER, SNACK],` use the [`generateMealPlan` mutation](https://docs.suggestic.com/graphql/query/mutations/meal-plan/generate-meal-plan) or the [customMealPlan mutation](https://docs.suggestic.com/graphql/query/queries/meal-plan/meal-plan).
* The `generateSimpleMealPlan` **does not** consider the user's macro goals. Instead, you can use the [`generateMealPlan`](https://docs.suggestic.com/graphql/query/mutations/meal-plan/generate-meal-plan) mutation.

{% hint style="success" %}
Don't forget to execute the [`mealPlan` ](https://docs.suggestic.com/graphql/query/queries/meal-plan/meal-plan-1)query to verify that your meal plan has been created successfully.
{% endhint %}

To understand how a meal plan works refer to [this guide](https://docs.suggestic.com/graphql/start-here/tutorials-and-walkthroughs/create-a-meal-plan).

### Available Arguments

| **Argument Name** |                                                 **Type**                                                |                                                                                            Description                                                                                            |
| :---------------: | :-----------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|     `addDays`     |                                                 Boolean                                                 |                         True to allow generating a new meal plan if a user is on her last meal plan day. This field is ignored if `ignoreLock` is true. Default is false.                         |
|     `isAppend`    |                                                 Boolean                                                 |                             True to add an additional week worth of meal plan (7 days) to the end of the current meal plan each time is executed. (Default is false.)                             |
|    `appendDays`   |                                                   Int                                                   |                                                After setting `isAppend` to *True* use `appendDays` to define the amount of days to append. (max 7)                                                |
|    `ignoreLock`   |                                                 Boolean                                                 |                                       True to allow generating a new meal plan any time, overwriting any pending days in the current plan. Default is false.                                      |
|      `repeat`     |                                                 Datetime                                                |                                                    Create a new meal plan repeating the 7 dates after repeat in user's history. Default to null                                                   |
|  `boostAdherence` |                                                 Boolean                                                 | **True** to consider **increase** and **decrease** rules in simpleMealPlan. All the recipes included will have a higher score. Otherwise is **False**. By default, this value is set to **false** |
|     `filters`     | [`SimpleMPFiltersInput`](https://docs.suggestic.com/graphql/objects/meal-plan/simple-meal-plan-filters) |  Object that generate a simple meal plan by using specific information such as `[`[`cuisines`](/graphql/objects/recipe/recipe-object/cuisines.md)`]` `caloric range`  `tags` and `maxTimeMinutes` |
|     `variety`     |                                                MPVariety                                                |                                             Define the variety of the recipes generated in the meal plan. Possible Values: `LOW`, `MEDIUM`, or `HIGH`                                             |

### Available Fields

The following fields will be displayed in the response:

| **Field** | **Type** |                               **Description**                               |
| :-------: | :------: | :-------------------------------------------------------------------------: |
| `success` |  Boolean | **True** if a meal entry has been created. Otherwise, it displays **False** |
| `message` |  String  |                          Description of the result                          |

## Examples

### Generate a 7-day meal plan

#### GraphQL Example

{% tabs %}
{% tab title="Mutation" %}

```graphql
mutation {
  generateSimpleMealPlan {
    success
    message
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
    "data": {
        "generateSimpleMealPlan": {
            "success": true,
            "message": "Meal plan was successfully created"
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### cURL Example

{% tabs %}
{% tab title="Request" %}

```json
curl -XPOST 'https://production.suggestic.com/graphql' \
  -H 'Authorization: Bearer <User-JWT' \
  -H 'Content-Type: application/json' \
  --data-raw '{"query":"mutation GenerateSimpleMealPlan {generateSimpleMealPlan { success  message }}"}'

```

{% endtab %}

{% tab title="Response" %}

```json
{
    "data": {
        "generateSimpleMealPlan": {
            "success": true,
            "message": "Meal plan was successfully created"
        }
    }
}
```

{% endtab %}
{% endtabs %}

If the user doesn't have enough history days, the following message is displayed:

{% tabs %}
{% tab title="Mutation" %}

```graphql
mutation {
  generateSimpleMealPlan (addDays:true ignoreLock:false repeat:"2021-10-21T10:25:14.120000Z"){
    success
    message
  }

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "generateSimpleMealPlan": {
      "success": false,
      "message": "Profile does not have enough days in history to complete a meal plan"
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Generate a meal plan over a meal plan in progress

If you try using `generateSimpleMealPlan`, while a meal plan is in progress, you'll get the following response:

{% tabs %}
{% tab title="Request" %}

```graphql
mutation {
  generateSimpleMealPlan {
    success
    message
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "data": {
        "generateSimpleMealPlan": {
            "success": false,
            "message": "User has a meal plan in progress."
        }
    }
}
```

{% endtab %}
{% endtabs %}

To bypass the lock, send the argument `ignoreLock: true` .

{% tabs %}
{% tab title="Request" %}

```graphql
mutation {
  generateSimpleMealPlan (addDays:true ignoreLock:true){
    success
    message
  }
}
```

{% endtab %}
{% endtabs %}

### Generate a meal plan that increases and decreases the rules

#### GraphQL Example

{% tabs %}
{% tab title="Mutation" %}

```graphql
mutation GenerateSimpleMealPlan {
  generateSimpleMealPlan(boostAdherence: true) {
    success
    message
  }
}

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
    "data": {
        "generateSimpleMealPlan": {
            "success": true,
            "message": "Meal plan was successfully created"
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### cURL Example

{% tabs %}
{% tab title="Request" %}

```json
curl -XPOST 'https://production.suggestic.com/graphql' \
  -H 'Authorization: Bearer <User-JWT>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"query":"mutation GenerateSimpleMealPlan{generateSimpleMealPlan(boostAdherence: true) {success message}}"}'
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "data": {
        "generateSimpleMealPlan": {
            "success": true,
            "message": "Meal plan was successfully created"
        }
    }
}
```

{% endtab %}
{% endtabs %}

### Generate a meal plan by setting caloric range for each meal time

{% tabs %}
{% tab title="Request" %}

```graphql
mutation {
  generateSimpleMealPlan(
    addDays: true
    ignoreLock: true
    filters: {
      kcalRange: {
        breakfast: { min: 100, max: 650 }
        lunch: { min: 100, max: 400 }
        snack: { min: 100, max: 300 }
        dinner: { min: 100, max: 400 }
      }
    }
  ) {
    success
    message
  }
}

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "generateSimpleMealPlan": {
      "success": true,
      "message": "Meal plan was successfully created"
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Generate a meal plan by setting caloric range and tags for each mealtime

{% tabs %}
{% tab title="Request" %}

```graphql
mutation {
  generateSimpleMealPlan(
    addDays: true
    ignoreLock: true
    filters: {
      kcalRange: { breakfast: { min: 100, max: 500 } }
      tags: { snack: ["salad"] }
    }
  ) {
    success
    message
  }
}


```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "generateSimpleMealPlan": {
      "success": true,
      "message": "Meal plan was successfully created"
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Generate a meal plan with a specific variety of recipes

{% tabs %}
{% tab title="Request" %}

```graphql
mutation {
  generateSimpleMealPlan (variety:MEDIUM){
    success
    message
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "generateSimpleMealPlan": {
      "success": true,
      "message": "Meal plan was successfully created"
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Generate a meal plan with a specific variety of cuisines

{% tabs %}
{% tab title="Request" %}

```graphql
mutation {
  generateSimpleMealPlan (filters:{cuisines:["Indian","Mexican","American"]}){
    success
    message
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "generateSimpleMealPlan": {
      "success": true,
      "message": "Meal plan was successfully created"
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Append days to active meal plan

{% tabs %}
{% tab title="Request" %}

```graphql
mutation{
  generateSimpleMealPlan(isAppend:true appendDays:4){
    success
    message
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "generateSimpleMealPlan": {
      "success": true,
      "message": "Meal plan was successfully created"
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Generate a meal plan with max time filter

{% tabs %}
{% tab title="Request" %}

```graphql
mutation {
  generateSimpleMealPlan(
    boostAdherence: true
    filters:{maxTimeMinutes:{breakfast:30 dinner:50 lunch:40 snack:15}}
  ) {
    success
    message
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "generateSimpleMealPlan": {
      "success": true,
      "message": "Meal plan was successfully created"
    }
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.suggestic.com/graphql/query/mutations/meal-plan/generate-simple-meal-plan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
