export const showMenu = async (reply) => {
  try {
    await reply({
      attachment: {
        type: 'template',
        payload: {
          template_type: 'generic',
          image_aspect_ratio: 'square',
          elements: [{
            title: 'Expenses menu',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See how much money you\'ve spent until now',
            buttons: [{
              type: 'postback',
              title: 'Open',
              payload: 'SHOW_EXPENSES_MENU',
            }]
          }, {
            title: 'Incomes menu',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See the positive income for your budget',
            buttons: [{
              type: 'postback',
              title: 'Open',
              payload: 'SHOW_INCOMES_MENU',
            }]
          }, {
            title: 'Threshold menu',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See what is going on with your prediction',
            buttons: [{
              type: 'postback',
              title: 'Open',
              payload: 'SHOW_THRESHOLD_MENU',
            }]
          }, {
            title: 'Salary',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See you current salary',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'SHOW_SALARY'
            }]
          }, {
            title: 'Account logout',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'Logout from EBudgie\'s account',
            buttons: [{
              type: 'account_unlink'
            }]
          }]
        }
      }
    });
  } catch (e) {
    console.log('Error during showing menu', e);
    await reply({
      text: 'Something went wrong. Please try again.'
    });
  }
};

export const showExpensesMenu = async (reply) => {
  try {
    await reply({
      attachment: {
        type: 'template',
        payload: {
          template_type: 'generic',
          image_aspect_ratio: 'square',
          elements: [{
            title: 'Monthly expenses count',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See total expenses for the current month',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'COUNT_MONTHLY_EXPENSES',
            }]
          }, {
            title: 'All expenses count',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See total expenses for all time',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'COUNT_ALL_EXPENSES',
            }]
          }, {
            title: 'Monthly expenses',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See each expense for the month',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'SHOW_MONTHLY_EXPENSES',
            }]
          }, {
            title: 'All expenses',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See each expense for all time',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'SHOW_ALL_EXPENSES',
            }]
          }]
        }
      }
    });
  } catch (e) {
    console.log('Error during showing expenses menu', e);
    await reply({
      text: 'Something went wrong. Please try again.'
    });
  }
};

export const showIncomesMenu = async (reply) => {
  try {
    await reply({
      attachment: {
        type: 'template',
        payload: {
          template_type: 'generic',
          image_aspect_ratio: 'square',
          elements: [{
            title: 'Monthly incomes count',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See total incomes for the current month',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'COUNT_MONTHLY_INCOMES',
            }]
          }, {
            title: 'All incomes count',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See total incomes for all time',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'COUNT_ALL_INCOMES',
            }]
          }, {
            title: 'Monthly incomes',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See each incomes for the month',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'SHOW_MONTHLY_INCOMES',
            }]
          }, {
            title: 'All incomes',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See each incomes for all time',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'SHOW_ALL_INCOMES',
            }]
          }]
        }
      }
    });
  } catch (e) {
    console.log('Error during showing incomes menu', e);
    await reply({
      text: 'Something went wrong. Please try again.'
    });
  }
};

export const showThresholdsMenu = async (reply) => {
  try {
    await reply({
      attachment: {
        type: 'template',
        payload: {
          template_type: 'generic',
          image_aspect_ratio: 'square',
          elements: [{
            title: 'Global threshold',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See total threshold results',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'SHOW_GLOBAL_THRESHOLD',
            }]
          }, {
            title: 'Categories threshold',
            image_url: `${process.env.API_URL}/public/login.png`,
            subtitle: 'See total incomes for all time',
            buttons: [{
              type: 'postback',
              title: 'Show',
              payload: 'SHOW_CATEGORIES_THRESHOLD',
            }]
          }]
        }
      }
    });
  } catch (e) {
    console.log('Error during showing threshold menu', e);
    await reply({
      text: 'Something went wrong. Please try again.'
    });
  }
};



@@ -2204,33 +2204,34 @@
 onthly expenses 
-c
+am
 ount',%0A         
@@ -2454,37 +2454,36 @@
       payload: '
-COUNT
+SHOW
 _MONTHLY_EXPENSE
@@ -2475,32 +2475,39 @@
 MONTHLY_EXPENSES
+_AMOUNT
 ',%0A            %7D
@@ -2556,17 +2556,18 @@
 xpenses 
-c
+am
 ount',%0A 
@@ -2793,29 +2793,28 @@
   payload: '
-COUNT
+SHOW
 _ALL_EXPENSE
@@ -2806,32 +2806,39 @@
 HOW_ALL_EXPENSES
+_AMOUNT
 ',%0A            %7D
@@ -3947,33 +3947,34 @@
 Monthly incomes 
-c
+am
 ount',%0A         
@@ -4204,21 +4204,20 @@
 yload: '
-COUNT
+SHOW
 _MONTHLY
@@ -4216,32 +4216,39 @@
 _MONTHLY_INCOMES
+_AMOUNT
 ',%0A            %7D
@@ -4296,17 +4296,18 @@
 incomes 
-c
+am
 ount',%0A 
@@ -4540,13 +4540,12 @@
 d: '
-COUNT
+SHOW
 _ALL
@@ -4544,32 +4544,39 @@
 SHOW_ALL_INCOMES
+_AMOUNT
 ',%0A            %7D

Change the payloads for some menus