<?php

namespace App\Http\Controllers\Api\System;

use App\Http\Controllers\Api\Core\BaseApiController;
use App\Models\Stats;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\Response;

class StatsController extends BaseApiController
{
    public function index()
    {
        try {
            $stats = Stats::query()->get()->toArray();
            return $this->success($stats, 'Statistics retrieved successfully');
        } catch (\Throwable $e) {
            Log::error('Stats retrieval error: '.$e->getMessage());
            return $this->respondError('Failed to retrieve statistics', Response::HTTP_INTERNAL_SERVER_ERROR);
        }
    }
}
