<?php
/**
 * Class PickupPointsData
 *
 * @package FS\InPost\PickupPoints
 */

namespace FS\InPost\PickupPoints;

use Exception;
use VendorInPost\WPDesk\PickupPoints\Cache\ObjectDataInterface;
use WPDesk_Paczkomaty_Plugin;
use WPDesk_Paczkomaty_ShipX_Exception;

/**
 * @codeCoverageIgnore
 */
class PickupPointsData implements ObjectDataInterface {

	/**
	 * @var WPDesk_Paczkomaty_Plugin
	 */
	private $plugin;

	/**
	 * @param WPDesk_Paczkomaty_Plugin $plugin
	 */
	public function __construct( WPDesk_Paczkomaty_Plugin $plugin ) {
		$this->plugin = $plugin;
	}

	/**
	 * @return array
	 * @throws Exception|WPDesk_Paczkomaty_ShipX_Exception .
	 */
	public function get() {
		return $this->plugin->get_paczkomaty_shipping_method()->get_shipX_cache()->get_points_options();
	}
}
