<?php

use GuzzleHttp\Client;

require_once __DIR__ . '/RestServiceClient.php';

class RestCrawlerServiceClient extends RestServiceClient
{

    public function __construct()
    { }

    public function saveVideo($params)
    {
        $response = $this->request('POST', '/api/v1/video', $params);
        return $response;
    }

    public function getProductByAsinCode($asinCode)
    {
        error_log('/amazon/product/detail/'. $asinCode);
        $response = $this->request('GET', '/amazon/product/detail/'. $asinCode, []);
        return $response;
    }

    public function getProductByBatchAsinCode($asinCode)
    {
        error_log('/amazon/product/detail/batch'. print_r($asinCode, true));
        $response = $this->request('POST', '/amazon/product/detail/batch', $asinCode);
        return $response;
    }

    public function getVideoCategory($params)
    {
        $response = $this->request('GET', '/api/v1/video/category', $params);
        return $response->data;
    }

    public function saveVideoCategory($params)
    {
        $response = $this->request('POST', '/api/v1/video/category', $params);
        return $response;
    }


    public function deleteVideo($params) {
        $response = $this->request('DELETE', '/api/v1/video', $params);
        return $response;
    }

    public function updateVideo($params) {
        $response = $this->request('PUT', '/api/v1/video', $params);
        return $response->data;
    }
}
