'use strict';

var apiService = require('../apiService').getInstance();

function DailyMenuResponse() {

}

DailyMenuResponse.prototype = {
    getResponse: function () {
        var products = apiService.getSellingMenus(categoryId);
        var response = {
            attachment: {
                type: "template",
                payload: {
                    template_type: "button",
                    text: "Witch Product do you want?",
                    buttons: []
                }
            }
        };

        if (products !== undefined) {
            var productNo = 0;
            products.forEach(function (product) {
                if (productNo < 3) {
                    var newButton = {
                        type: "postback",
                        title: product.name,
                        payload: "product#" + product._id
                    };

                    response.attachment.payload.buttons.push(newButton);
                }
            });
        }

        return JSON.stringify(response);
    }
};

/**
 * @returns {DailyMenuResponse}
 */
module.exports.getInstance = function () {
    return new DailyMenuResponse();
};

@@ -160,24 +160,88 @@
 nction () %7B%0A
+        var date = new Date().toISOString().replace(/T.+/, '');%0A
         var 
@@ -282,21 +282,16 @@
 nus(
-c
+d
 ate
-goryId
 );%0A
+%0A
     

add notifier