
<link rel="import" href="../list/nuxeo-similar-images.html">

<!--
`nuxeo-similar-images-tab`
@group Nuxeo UI
@element nuxeo-similar-images-tab
-->
<dom-module id="nuxeo-similar-images-tab">
  <template>
    <style include="nuxeo-styles">
      :host {
        display: block;
      }
    </style>
    
    <nuxeo-similar-images document="[[document]]" visible="[[visible]]" provider-name="simple-vector-search"
                          search-property="embedding:image" search-value="[[searchValue]]">
    </nuxeo-similar-images>
    
  </template>

  <script>
    Polymer({
      is: 'nuxeo-similar-images-tab',
      properties: {
        document: {
          type: Object,
        },
        
        visible: {
          type: Boolean
        },
        
        searchValue: {
          type: String,
          computed: '_computeSearchValue(document,visible)'
        } 
      },
      
      _computeSearchValue: function(document,visible) {
        if (!visible || !document || !document.properties['embedding:image']) {
          return;
        }
        return JSON.stringify(document.properties['embedding:image']);
      }
      
    });
  </script>
</dom-module>

