'use strict';

var cbConnection = require('./CouchbaseConnection');

module.exports = {

  fetchFileReferenceDocumentQuery: function(fileUploaderField, fileNo, options){
      let connectionName = options ? options.connectionName : null;
      const bucketName = cbConnection.getConfig(connectionName).bucket;

      let statement = "SELECT `" + bucketName + "`.* FROM `" + bucketName + "` WHERE ";
      statement += "systemHeader.systemType = '" + SharedConstants.SYSTEM_TYPE_FILE_REFERENCE + "' AND ";
      statement += "(ANY v IN fileDetails SATISFIES v.fileNo IN ['" + fileNo +"']  END )";

      return statement;

  }

};
