<?php

namespace CarDealerPress\Includes\Functions;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}


class Dealertrend_API {
	use Logger;
	public static function api_vehicles_params( $args = array() ): string {
		$page      = $args['page'] ?? 1;
		$per_page  = $args['per_page'] ?? PER_PAGE_LIMIT;

		return "?page=$page&per_page=$per_page&photo_view=1"; // todo future add &dealer_options=true
	}

	public static function base_dealertrend_api_url($dealer_id): string {
		return "/$dealer_id/inventory/vehicles.json";
	}

	public static function api_vehicles_url( $args = array() ): string {
		$dealer_id = $args['dealer_id'] ?? 0;
		return BASE_INVENTORY_API_URL . self::base_dealertrend_api_url($dealer_id) . self::api_vehicles_params( $args );
	}

}