<?php

namespace App\Repositories\Shop;

class Dashboards
{
    public static function getStats($start, $end)
    {
        return [
            'orders_count' => OrderMetrics::countByPeriod($start, $end),
            'orders_sum' => OrderMetrics::sumByPeriod($start, $end, 'total_shipped'),
            'orders_avg' => OrderMetrics::avgByPeriod($start, $end, 'total_shipped'),
            'countClients' => CustomerMetrics::countByPeriod($start, $end),
            'waitingOrders' => OrderMetrics::countWaiting(),
            'preparationLess24H' => OrderMetrics::countPreparationLess24h(),
            'preparationLess48H' => OrderMetrics::countPreparationLess48h(),
            'preparationMore48H' => OrderMetrics::countPreparationMore48h(),
            'offers_count' => Offers::count(),
            'stocksWarning' => OfferStocks::countAlerts(),
            'countCustomers' => Customers::count(),
            'lastOrders' => Orders::getLast(),
        ];
    }
}
