'use strict';

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

module.exports = {

  findAuditDocumentQuery: function(id, options){
      let connectionName = options ? options.connectionName : null;
      const bucketName = cbConnection.getConfig(connectionName).bucket;

      let statement = "SELECT `" + bucketName + "`.* FROM `" + bucketName + "` WHERE ";
      statement += "documentId = '" + id + "'  ";

      let sortQuery = "ORDER BY systemHeader.createdDate DESC";

    return  {query : statement, sortQuery: sortQuery };

  }

};