<?php

namespace endpoints\products;

use traits\economic_endpoint_t;

class economic_products_endpoint
{
    use economic_endpoint_t;

    /**
     * List all products
     * @param array $filters Example: ['filter' => 'value']
     * @param array $pagination Example: ['maxPageSize' => 100, 'skipPages' => 0]
     * @return object {collection: [product], pagination: {maxPageSize: number, skipPages: number, results: number}}
     */
    public function get(array $filters = [], array $pagination = []): object
    {
        $response = $this->send_request(
            '/products/?filter=' . self::filters($filters) . self::pagination($pagination),
            'GET');
        // Return the response as an object
        return json_decode($response);
    }

}