<?php

namespace App\Services;

class AnalyticsService
{
    public function operationsSnapshot(): array
    {
        $db=db_connect();
        return [
            'requests_today'=>$db->table('care_requests')->where('created_at >=',date('Y-m-d 00:00:00'))->countAllResults(),
            'completed_today'=>$db->table('care_requests')->where('status','completed')->where('completed_at >=',date('Y-m-d 00:00:00'))->countAllResults(),
            'verified_practitioners'=>$db->table('practitioner_profiles')->where('verification_status','verified')->countAllResults(),
            'active_patients'=>$db->table('users')->where(['role'=>'patient','status'=>'active'])->countAllResults(),
        ];
    }
}
