<?php

namespace endpoints\departments;

use traits\economic_endpoint_t;

class economic_departments_endpoint
{
    use economic_endpoint_t;

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

}