<?php

if (! defined('ABSPATH')) exit;

function minicomerce_customers_resume()
{
   if (! current_user_can('manage_options')) {
      wp_die(esc_html__('You do not have sufficient permissions to access this page.', 'minicomerce'));
   }

   global $wpdb;
   $table_name = esc_sql($wpdb->prefix . MINICOMERCE_REPORTS);

   $resume = [];
 
   $resume['total'] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i", $table_name));
   $resume['verified'] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE verified = 1", $table_name));
   $resume['payReceived'] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE payReceived = 1", $table_name));

   return $resume;
}