{
  "name": "example",
  "label": "Example",
  "description": "An adapter for examples and demonstrations.",
  "version": "0.0.0",
  "infoUrl": "https://www.example.com/",
  "maintainer": "Kendraio",
  "supportUrl": "https://www.kendra.io",
  "database": [],
  "workflow": [
    {
      "title": "Product Chart",
      "config": "configs/productChart.json"
    },
    {
      "title": "Custom form elements",
      "config": "configs/customFormElements.json"
    }
  ],
  "forms": [
    {
      "formId": "customElements",
      "title": "Custom Elements Demo",
      "jsonSchema": "schemas/customElements.schema.json",
      "uiSchema": "forms/customElements.ui.json"
    }
  ],
  "tags": [
    "example",
    "test"
  ],
  "attachments": {
    "configs/customFormElements.json": {
      "title": "Custom form elements",
      "blocks": [
        {
          "type": "form",
          "adapter": "example",
          "formId": "customElements"
        }
      ]
    },
    "configs/productChart.json": {
      "title": "Product Chart",
      "blocks": [
        {
          "type": "actions",
          "buttons": [
            {
              "label": "Generate",
              "color": "primary",
              "blocks": [
                {
                  "type": "init"
                }
              ]
            }
          ]
        },
        {
          "type": "faker",
          "jsonSchema": {
            "type": "array",
            "minItems": 20,
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "faker": "commerce.productName"
                },
                "value": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 120
                }
              },
              "required": [
                "label",
                "value"
              ]
            }
          }
        },
        {
          "type": "chart",
          "chartType": "bar"
        }
      ]
    },
    "configs/test-api.json": {
      "title": "Test API Import",
      "blocks": [
        {
          "type": "init"
        },
        {
          "type": "http",
          "method": "get",
          "endpoint": "https://google-sheets-api-proxy.now.sh"
        },
        {
          "type": "batch",
          "blocks": [
            {
              "type": "context",
              "contextPath": "entityType",
              "contextBlocks": [
                {
                  "type": "mapping",
                  "mapping": "data"
                }
              ],
              "blocks": [
                {
                  "type": "actions",
                  "buttons": [
                    {
                      "labelGetter": "join('', ['Import ', context.entityType])",
                      "blocks": [
                        {
                          "type": "http",
                          "method": "get",
                          "endpoint": {
                            "protocol": "https:",
                            "host": "google-sheets-api-proxy.now.sh",
                            "valueGetters": {
                              "pathname": "['/', data].join('', @)"
                            }
                          }
                        },
                        {
                          "type": "mapping",
                          "mapping": "data[].id[].['/', _(&to_string(context.entityType)), '/', @]"
                        },
                        {
                          "type": "batch",
                          "blocks": [
                            {
                              "type": "mapping",
                              "mapping": "map(&to_string(@), data).join('', @)"
                            },
                            {
                              "type": "http",
                              "method": "get",
                              "skipInit": false,
                              "endpoint": {
                                "protocol": "https:",
                                "host": "google-sheets-api-proxy.now.sh",
                                "valueGetters": {
                                  "pathname": "data"
                                }
                              }
                            },
                            {
                              "type": "mapping",
                              "mapping": "data && merge(data, { uuid: uuid() })"
                            },
                            {
                              "type": "db",
                              "operation": "add",
                              "adapterName": "testApi",
                              "schemaGetter": "context.entityType"
                            }
                          ]
                        },
                        {
                          "type": "card",
                          "blocks": [
                            {
                              "type": "mapping",
                              "mapping": "((type(data) == 'array') && length(data)) || false"
                            },
                            {
                              "type": "message",
                              "message": "{{#if data}}Imported {{data}} items{{else}}Importing...{{/if}}"
                            },
                            {
                              "type": "actions",
                              "buttons": [
                                {
                                  "label": "Done",
                                  "color": "primary",
                                  "blocks": [
                                    {
                                      "type": "init"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    "configs/view-imported-data.json": {
      "title": "Test API - view imported data",
      "blocks": [
        {
          "type": "init"
        },
        {
          "type": "http",
          "method": "get",
          "endpoint": "https://google-sheets-api-proxy.now.sh"
        },
        {
          "type": "mapping",
          "mapping": "data[].{ label: @, value: @ }"
        },
        {
          "type": "reference",
          "fieldLabel": "Select entity type",
          "labelField": "label",
          "valueField": "value"
        },
        {
          "type": "db",
          "operation": "get",
          "adapterName": "testApi",
          "schemaGetter": "data"
        },
        {
          "type": "grid"
        }
      ]
    },
    "forms/customElements.ui.json": {
      "password": {
        "ui:disabled": false,
        "ui:placeholder": "This is a custom Password field",
        "ui:widget": "k-password"
      },
      "money": {
        "ui:widget": "money"
      },
      "percentage": {
        "ui:widget": "percentage"
      },
      "datepicker": {
        "ui:widget": "datepicker"
      },
      "time12": {
        "ui:widget": "k-timepicker",
        "ui:hideClock": true,
        "ui:timeFormat": 12
      },
      "time24": {
        "ui:widget": "k-timepicker",
        "ui:hideClock": false,
        "ui:timeFormat": 24
      },
      "textarea": {
        "ui:disabled": false,
        "ui:placeholder": "This is a Smart Textarea",
        "ui:autofocus": true,
        "ui:widget": "k-textarea",
        "ui:rows": 8,
        "ui:cols": 3,
        "ui:errMessage": {
          "required": "Excuse me, this field is required!!",
          "minLength": "Please enter more Characters",
          "maxLength": "This field cannot except that many Characters. "
        }
      },
      "videoViewer": {
        "ui:widget": "videoviewer"
      },
      "thumbnails": {
        "ui:widget": "thumbnailviewer"
      },
      "countries": {
        "ui:widget": "countries"
      },
      "selectMulti": {
        "ui:widget": "k-select",
        "ui:labelProp": "name",
        "ui:valueProp": "alpha3Code",
        "ui:isMultiSelect": true,
        "ui:ref": "testCountries",
        "ui:refType": "http"
      },
      "selectautocomplete": {
        "ui:widget": "k-select",
        "ui:labelProp": "name",
        "ui:valueProp": "alpha3Code",
        "ui:isMultiSelect": false,
        "ui:ref": "testCountries",
        "ui:refType": "json"
      },
      "selectremotedata": {
        "ui:widget": "k-select",
        "ui:labelProp": "name",
        "ui:valueProp": "alpha3Code",
        "ui:isMultiSelect": false,
        "ui:ref": "testRegion",
        "ui:refType": "http"
      },
      "selectaddnew": {
        "ui:widget": "k-select",
        "ui:addTag": true,
        "ui:labelProp": "name",
        "ui:valueProp": "alpha3Code",
        "ui:isMultiSelect": false,
        "ui:ref": "testRegion",
        "ui:refType": "http"
      },
      "tags": {
        "ui:widget": "tags"
      },
      "visibility": {
        "ui:widget": "visibility"
      },
      "playlist": {
        "ui:widget": "playlist"
      }
    },
    "schemas/customElements.schema.json": {
      "title": "Custom Elements Demo",
      "description": "This is a demo of all the Custom Element currently available Kendraio App",
      "type": "object",
      "required": [
        "title",
        "description"
      ],
      "properties": {
        "videoViewer": {
          "title": "The Video Viewer",
          "description": "Embeds a YouTube Video on a form",
          "type": "string"
        },
        "password": {
          "title": "Password",
          "description": "",
          "type": "string"
        },
        "money": {
          "title": "Money",
          "description": "Uses a mask to aid correct entry of an amount of money",
          "type": "string"
        },
        "percentage": {
          "title": "Pecentage",
          "description": "Uses a mask to aid correct entry of a Percentage",
          "type": "string"
        },
        "datepicker": {
          "title": "Date Picker",
          "description": "This is a Date Picker",
          "type": "string"
        },
        "time12": {
          "title": "Time 12hr",
          "description": "Uses a mask to aid correct entry of a Percentage",
          "type": "string"
        },
        "time24": {
          "title": "Time Picker 24hrs with Clock Dialog",
          "description": "Time Picker 24hr format with pop-up clock",
          "type": "string"
        },
        "countries": {
          "title": "Country List",
          "description": "Presents a list of Countries(hard coded) and flags ",
          "type": "string"
        },
        "selectMulti": {
          "title": "Custom Select with Multiselect and Autocomplete",
          "description": "",
          "type": "string"
        },
        "selectautocomplete": {
          "title": "Custom Select with Autocomplete (JSon, Local data)",
          "description": "",
          "type": "string"
        },
        "selectremotedata": {
          "title": "Custom Select with Autocomplete from remote API",
          "description": "Data is from https://restcountries.eu/rest/",
          "type": "string"
        },
        "selectaddnew": {
          "title": "Custom Select allowing new item to be added",
          "description": "Data is from https://restcountries.eu/rest/",
          "type": "string"
        },
        "textarea": {
          "type": "string",
          "title": "Smart Textarea",
          "minLength": 2,
          "maxLength": 203,
          "description": "This is a custom Textarea with additional user feedback"
        },
        "thumbnails": {
          "type": "string",
          "title": "Thumbnail Viewer",
          "description": "Allows the display of Thumbnails"
        },
        "tags": {
          "type": "string",
          "title": "Tags ",
          "description": "Press enter to add a tag"
        },
        "visibility": {
          "type": "object",
          "title": "Visibility "
        },
        "playlist": {
          "type": "object",
          "title": "Playlists"
        }
      }
    }
  }
}