<?php

use api\classes\API_companies;

session_start();

require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_companies.php";


$API_companies = new API_companies();

if (!$GLOBALS['modules_enabled']['customers']) {
    echo '405 Not Allowed';
    exit;
}

if ($API_companies->request_method === 'GET') {
    $API_companies->checkPermissions('customer-companies', 'RO');

    $companies = $API_companies->getCompanies();

    $API_companies->apiOutput($code = 200, $data = $companies);

}