{
  "name": "teosto",
  "label": "Teosto",
  "description": "Teosto is a non-profit performance rights organization that collects royalties on behalf of songwriters and composers in Finland.",
  "version": "0.1.0",
  "infoUrl": "https://www.teosto.fi/",
  "maintainer": "Kendraio",
  "supportUrl": "http://kendra.io",
  "database": [],
  "dashboard": {
    "icon": "brightness_5",
    "label": "Teosto",
    "workflowId": "listWorks"
  },
  "services": [
    {
      "label": "Works",
      "icon": "file_copy",
      "workflowId": "listWorks"
    },
    {
      "label": "Search by name",
      "icon": "file_copy",
      "workflowId": "authorsWorksByName"
    },
    {
      "label": "Search by IPI",
      "icon": "file_copy",
      "workflowId": "authorsWorksFromIPI"
    },
    {
      "label": "Search by ISWC",
      "icon": "file_copy",
      "workflowId": "getRightsHolderForISWC"
    },
    {
      "label": "Search by publisher",
      "icon": "file_copy",
      "workflowId": "listPublishersWorks"
    }
  ],
  "workflow": [
    {
      "title": "List works (with selection)",
      "workflowId": "listWorksSelectionExample",
      "config": "configs/listWorksSelectionExample.json"
    }
  ],
  "forms": [],
  "tags": [
    "music",
    "b2b",
    "demo"
  ],
  "attachments": {
    "configs/authorsWorksByName.json": {
      "title": "Get author's works by name",
      "blocks": [
        {
          "type": "form",
          "jsonSchema": {
            "title": "Get author's works by name",
            "type": "object",
            "required": [
              "last_name"
            ],
            "properties": {
              "last_name": {
                "title": "Last name",
                "type": "string",
                "default": "HELISMAA"
              },
              "first_name": {
                "title": "First name",
                "type": "string",
                "default": "REINO"
              },
              "limit": {
                "title": "Number of results",
                "type": "integer",
                "default": 2
              }
            }
          },
          "uiSchema": {}
        },
        {
          "type": "query",
          "dataSource": {
            "type": "remote",
            "endpoint": {
              "protocol": "https:",
              "host": "teosto-cors-proxy-eilgg5e92.now.sh",
              "pathname": "/dev/rest/work/searchAuthor",
              "query": {
                "limit": 4
              },
              "valueGetters": {
                "query": "{limit: model.limit, last_name: model.last_name, first_name: model.first_name}"
              }
            },
            "authentication": {
              "type": "basic-auth",
              "valueGetters": {
                "username": "user.teosto.username",
                "password": "user.teosto.password"
              }
            }
          }
        },
        {
          "type": "mapping",
          "mapping": "data[].{ workkey: workkey, titles: titles[?title_type=='OT'].work_title, performer: performers.name, right_owners: right_owners[].name }"
        },
        {
          "type": "grid",
          "columnDefs": [
            {
              "headerName": "Work key",
              "field": "workkey"
            },
            {
              "headerName": "Titles",
              "valueGetter": "titles"
            },
            {
              "headerName": "Performer",
              "valueGetter": "performer"
            },
            {
              "headerName": "Rights owners",
              "valueGetter": "right_owners"
            }
          ]
        }
      ]
    },
    "configs/authorsWorksFromIPI.json": {
      "title": "Author's works from IPI",
      "blocks": [
        {
          "type": "form",
          "jsonSchema": {
            "title": "Get authors works from IPI",
            "type": "object",
            "properties": {
              "limit": {
                "title": "How many results to fetch?",
                "type": "integer",
                "default": 2
              }
            }
          },
          "uiSchema": {}
        },
        {
          "type": "query",
          "dataSource": {
            "type": "remote",
            "endpoint": {
              "protocol": "https:",
              "host": "teosto-cors-proxy-eilgg5e92.now.sh",
              "pathname": "/dev/rest/work/searchAuthor_IPI",
              "query": {
                "limit": 4
              },
              "valueGetters": {
                "query": "{IPI: user.profile.ipi, limit: model.limit}"
              }
            },
            "authentication": {
              "type": "basic-auth",
              "valueGetters": {
                "username": "user.teosto.username",
                "password": "user.teosto.password"
              }
            }
          }
        },
        {
          "type": "mapping",
          "mapping": "data[].{ workkey: workkey, titles: titles[?title_type=='OT'].work_title, performer: performers.name, right_owners: right_owners[].name }"
        },
        {
          "type": "grid",
          "columnDefs": [
            {
              "headerName": "Work key",
              "field": "workkey"
            },
            {
              "headerName": "Titles",
              "valueGetter": "titles"
            },
            {
              "headerName": "Performer",
              "valueGetter": "performer"
            },
            {
              "headerName": "Rights owners",
              "valueGetter": "right_owners"
            }
          ]
        }
      ]
    },
    "configs/getRightsHolderForISWC.json": {
      "title": "Get rights holders per ISWC",
      "blocks": [
        {
          "type": "form",
          "jsonSchema": {
            "title": "Get rights holders per ISWC",
            "type": "object",
            "required": [
              "iswc"
            ],
            "properties": {
              "iswc": {
                "title": "ISWC",
                "type": "string",
                "default": "T-912.457.854-7"
              }
            }
          },
          "uiSchema": {}
        },
        {
          "type": "query",
          "dataSource": {
            "type": "remote",
            "endpoint": {
              "protocol": "https:",
              "host": "teosto-cors-proxy-eilgg5e92.now.sh",
              "query": {
                "limit": 1
              },
              "valueGetters": {
                "pathname": "join('', ['/dev/rest/work/perISWC/', model.iswc])"
              }
            },
            "authentication": {
              "type": "basic-auth",
              "valueGetters": {
                "username": "user.teosto.username",
                "password": "user.teosto.password"
              }
            }
          }
        },
        {
          "type": "mapping",
          "mapping": "data[].right_owners[]"
        },
        {
          "type": "grid",
          "columnDefs": [
            {
              "headerName": "IPI Name Number",
              "field": "ipi_name_nbr"
            },
            {
              "headerName": "Name",
              "valueGetter": "name"
            },
            {
              "headerName": "First name",
              "valueGetter": "firstname"
            },
            {
              "headerName": "Local name",
              "valueGetter": "local_name"
            },
            {
              "headerName": "Local first name",
              "valueGetter": "local_firstname"
            },
            {
              "headerName": "Type",
              "valueGetter": "type"
            },
            {
              "headerName": "Performance society",
              "valueGetter": "performance_society"
            },
            {
              "headerName": "Mechanical society",
              "valueGetter": "mechanical_society"
            }
          ]
        }
      ]
    },
    "configs/listPublishersWorks.json": {
      "title": "List publisher's works",
      "blocks": [
        {
          "type": "form",
          "jsonSchema": {
            "title": "List publisher's works",
            "type": "object",
            "properties": {
              "name": {
                "title": "Publisher",
                "type": "string",
                "default": "WARNER CHAPPELL MUSIC FINLAND OY"
              },
              "limit": {
                "title": "How many results to fetch?",
                "type": "integer",
                "default": 2
              }
            }
          },
          "uiSchema": {}
        },
        {
          "type": "query",
          "dataSource": {
            "type": "remote",
            "endpoint": {
              "protocol": "https:",
              "host": "teosto-cors-proxy-eilgg5e92.now.sh",
              "pathname": "/dev/rest/work/searchPublisher",
              "query": {
                "limit": 4
              },
              "valueGetters": {
                "query": "{PUBLISHER: model.name, limit: model.limit}"
              }
            },
            "authentication": {
              "type": "basic-auth",
              "valueGetters": {
                "username": "user.teosto.username",
                "password": "user.teosto.password"
              }
            }
          }
        },
        {
          "type": "mapping",
          "mapping": "data[].{ workkey: workkey, titles: titles[?title_type=='OT'].work_title, performer: performers.name, right_owners: right_owners[].name }"
        },
        {
          "type": "grid",
          "columnDefs": [
            {
              "headerName": "Work key",
              "field": "workkey"
            },
            {
              "headerName": "Titles",
              "valueGetter": "titles"
            },
            {
              "headerName": "Performer",
              "valueGetter": "performer"
            },
            {
              "headerName": "Rights owners",
              "valueGetter": "right_owners"
            }
          ]
        }
      ]
    },
    "configs/listWorks.json": {
      "title": "List works",
      "blocks": [
        {
          "type": "form",
          "jsonSchema": {
            "title": "Get works per title",
            "type": "object",
            "properties": {
              "term": {
                "title": "Search term",
                "type": "string",
                "default": "HEART"
              },
              "limit": {
                "title": "Limit",
                "type": "integer",
                "default": 2
              }
            }
          },
          "uiSchema": {}
        },
        {
          "type": "query",
          "dataSource": {
            "type": "remote",
            "endpoint": {
              "protocol": "https:",
              "host": "teosto-cors-proxy-eilgg5e92.now.sh",
              "pathname": "/dev/rest/work/perTitle/HEART",
              "query": {
                "limit": 4
              },
              "valueGetters": {
                "pathname": "join('', ['/dev/rest/work/perTitle/', model.term])",
                "query": "{limit: model.limit}"
              }
            },
            "authentication": {
              "type": "basic-auth",
              "valueGetters": {
                "username": "user.teosto.username",
                "password": "user.teosto.password"
              }
            }
          }
        },
        {
          "type": "mapping",
          "mapping": "data[].{ workkey: workkey, titles: titles[?title_type=='OT'].work_title, performer: performers.name, right_owners: right_owners[].name }"
        },
        {
          "type": "grid",
          "columnDefs": [
            {
              "headerName": "Work key",
              "field": "workkey"
            },
            {
              "headerName": "Titles",
              "valueGetter": "titles"
            },
            {
              "headerName": "Performer",
              "valueGetter": "performer"
            },
            {
              "headerName": "Rights owners",
              "valueGetter": "right_owners"
            }
          ]
        }
      ]
    },
    "configs/listWorksSelectionExample.json": {
      "title": "List works (with selection)",
      "blocks": [
        {
          "type": "form",
          "jsonSchema": {
            "title": "Get works per title",
            "type": "object",
            "properties": {
              "term": {
                "title": "Search term",
                "type": "string",
                "default": "HEART"
              },
              "limit": {
                "title": "Limit",
                "type": "integer",
                "default": 2
              }
            }
          },
          "uiSchema": {}
        },
        {
          "type": "query",
          "dataSource": {
            "type": "remote",
            "endpoint": {
              "protocol": "https:",
              "host": "teosto-cors-proxy-eilgg5e92.now.sh",
              "pathname": "/dev/rest/work/perTitle/HEART",
              "query": {
                "limit": 4
              },
              "valueGetters": {
                "pathname": "join('', ['/dev/rest/work/perTitle/', model.term])",
                "query": "{limit: model.limit}"
              }
            },
            "authentication": {
              "type": "basic-auth",
              "valueGetters": {
                "username": "user.teosto.username",
                "password": "user.teosto.password"
              }
            }
          }
        },
        {
          "type": "mapping",
          "mapping": "data[]"
        },
        {
          "type": "grid",
          "columnDefs": [
            {
              "headerName": "Work key",
              "field": "workkey",
              "checkboxSelection": true
            },
            {
              "headerName": "Titles",
              "valueGetter": "titles[?title_type=='OT'].work_title"
            },
            {
              "headerName": "Performer",
              "valueGetter": "performers.name"
            },
            {
              "headerName": "Rights owners",
              "valueGetter": "right_owners[].name"
            }
          ]
        },
        {
          "type": "mapping",
          "mapping": "[0]"
        },
        {
          "type": "mapping",
          "mapping": "{ title: titles[?title_type=='OT'].work_title | [0], selection: @}"
        },
        {
          "type": "message",
          "title": "Selection item: {{title}}",
          "message": "Rights owners: {{#each selection.right_owners}}{{name}} ({{type}}){{#unless @last}}, {{/unless}}{{/each}}"
        },
        {
          "type": "debug"
        }
      ]
    }
  }
}