# Create supplement plan for user

Use `createSupplementPlan` to add new supplement plan to an user.

## Required Arguments

| Argument                                | Type                      | Description                                                                         |
| --------------------------------------- | ------------------------- | ----------------------------------------------------------------------------------- |
| `fromTemplate`                          | ID                        | Use this to create a supplement plan from a template (Telewellness Portal).         |
| `name`                                  | String!                   | Supplement plan name.                                                               |
| `isActive`                              | Boolean!                  | ***True*** sets the supplement plan active for the user, otherwise ***False***.     |
| `visibility`                            | Boolean!                  | ***True*** makes the supplement plan visible for the user, otherwise ***False***.   |
| `coach`                                 | ID!                       | Id of Coach.                                                                        |
| `startDate`                             | Date!                     | Sets the starting date for the supplement plan. YYYY-MM-DD                          |
| `nutrition`                             | String                    | Open text field.                                                                    |
| `resources`                             | String                    | Open text field.                                                                    |
| `overview`                              | String                    | Open text field.                                                                    |
| `exercise`                              | String                    | Open text field.                                                                    |
| `supplements`                           | \[Supplements]            | Supplement or list of supplements.                                                  |
| `supplements.supplementId`              | ID!                       | Id of supplement.                                                                   |
| `supplements.length`                    | Int!                      | Length duration of supplement.                                                      |
| `supplements.directionsOfUse`           | SupplementDirection!      | Direction of use for supplement.                                                    |
| `supplements.directionsOfUse.quantity`  | Float!                    | Supplement quantity.                                                                |
| `supplements.directionsOfUse.timeOfDay` | TimeOfDay!                | enum TimeOfDay { AT\_BEDTIME AT\_WAKING WITH\_BREAKFAST WITH\_DINNER WITH\_LUNCH }. |
| `supplements.<DAYOFWEEK>`               | Boolean!                  | Can be any day of the week ex. `sunday: true`                                       |
| `protocols`                             | \[SupplementPlanProtocol] | Protocol or list of protocols.                                                      |
| `protocols.protocolId`                  | ID!                       | Id of Protocol.                                                                     |
| `protocols.isActive`                    | Boolean!                  | ***True*** sets the protocol active for the user, otherwise ***False***.            |
| `protocols.directionsOfUse`             | SupplementDirection!      | Direction of use for protocol.                                                      |
| `protocols.directionsOfUse.quantity`    | Float!                    | Protocol quantity.                                                                  |
| `protocols.directionsOfUse.timeOfDay`   | TimeOfDay                 | enum TimeOfDay { AT\_BEDTIME AT\_WAKING WITH\_BREAKFAST WITH\_DINNER WITH\_LUNCH }. |
| `protocols.<DAYOFWEEK>`                 | Boolean!                  | Can be any day of the week ex. `sunday: true`                                       |

## Example

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

```graphql
mutation {
  createSupplementPlan (
    input:{
      name:"Suggestic Plan"
      isActive: true
      visibility: true
      coach:"Q29hY2g6NTA0Mw=="
      startDate:"2024-06-01"
      nutrition:"Placeholder Text"
      resources:"Placeholder Text"
      overview:"Placeholder Text"
      exercise:"Placeholder Text"
      protocols:{
        protocolId:"UHJvdG9jb2w6MzA1NTc0" 
        isActive:true 
        directionsOfUse:{
          quantity:10 
          timeOfDay:AT_WAKING
          } 
        wednesday:true
      }
      supplements:[{
        supplementId:"U3VwcGxlbWVudDoxZjNhZjAzYi01ZWQzLTQ0ZTUtYTE4MS03NTAwOWVlNmI1NjE="
	length:30
        directionsOfUse:{
          quantity:10 
          timeOfDay:WITH_BREAKFAST
        }
        saturday:true
      },{
        supplementId:"U3VwcGxlbWVudDpjYzI1YzZkNC0wNzYwLTRmNzItYTU4MS0xYmJhZmViYWY3Zjg="
	length:10
        directionsOfUse:{
          quantity:5 
          timeOfDay:WITH_DINNER
        }
        monday: true
        wednesday: true
        friday: true
      }],
    }
  ){
    success
    message
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "createSupplementPlan": {
      "success": true,
      "message": "Supplement plan created"
    }
  }
}
```

{% endtab %}
{% endtabs %}
