<?php

namespace App\Platform\Tools\Request;

use App\Platform\Tools\HttpClient;
use GuzzleHttp\Client;
use Hyperf\Collection\LazyCollection;

class KpiRequest extends HttpClient
{

    const BATCH_SIZE = 20;
    
    public static function find(int $store_id, string $date): mixed
    {
        $path = "/api/ext/kpi";
        $response = static::get($path, ['store' => $store_id, 'from' => $date, 'to' => $date]);
        return isset($response['data']) && !empty($response['data']) ? $response['data']['0'] : null;
    }
    
    public static function add(array $data): array
    {
        $path = "/api/ext/kpi";
        return static::post($path, [], $data);
    }

    public static function update(array $data): array
    {
        $path = "/api/ext/kpi";
        return static::put($path, [], $data);
    }
}
