<?php

namespace Simplyin\Simplyin_W_Plugin\Shipping_Mapping\Simplyin;

class Simplyin_Method_Factory {

	static protected array $methods_cache = [];


	/**
	 * @return Simplyin_Method_Interface[]
	 */
	public function get_available_simply_methods(): array {

		if ( empty( self::$methods_cache ) ) {
			self::$methods_cache = [
				$this->create_inpost_parcel_locker(),
				$this->create_dpd_point(),
				$this->create_dhl_parcelshop(),
				$this->create_orlen_parcel_locker(),
				$this->create_ups_parcel_locker(),
				$this->create_gls_parcel_locker(),
				$this->create_fedex_parcel_locker(),
				$this->create_poczta_parcel_locker(),
				$this->create_door_delivery(),
			];
		}

		return self::$methods_cache;
	}

	public function create_inpost_parcel_locker(): Simplyin_Method {
		return new Simplyin_Method(
			'inpost_parcel_locker',
			_x(
				'InPost Parcel Locker and ParcelPoint',
				'shipping_method_label.inpost',
				'simplyin'
			),
			'inpost',
		);
	}

	public function create_dpd_point(): Simplyin_Method {
		return new Simplyin_Method(
			'dpd_point',
			_x(
				'DPD Parcel Locker and Pickup Point',
				'shipping_method_label.dpd',
				'simplyin'
			),
			'dpd',
		);
	}

	public function create_dhl_parcelshop(): Simplyin_Method {
		return new Simplyin_Method(
			'dhl_parcelshop',
			_x(
				'DHL BOX Machine and DHL POP Collection Point',
				'shipping_method_label.dhl',
				'simplyin'
			),
			'dhl',
		);
	}

	public function create_orlen_parcel_locker(): Simplyin_Method {
		return new Simplyin_Method(
			'orlen_parcel_locker',
			_x(
				'ORLEN Parcel Locker and PUDO Point',
				'shipping_method_label.orlen',
				'simplyin'
			),
			'orlen',
		);
	}

	public function create_ups_parcel_locker(): Simplyin_Method {
		return new Simplyin_Method(
			'ups_access_point',
			_x(
				'UPS Access Point ',
				'shipping_method_label.ups',
				'simplyin'
			),
			'ups',
		);
	}

	public function create_gls_parcel_locker(): Simplyin_Method {
		return new Simplyin_Method(
			'gls_access_point',
			_x(
				'GLS Parcel Locker and Pickup Point',
				'shipping_method_label.gls',
				'simplyin'
			),
			'gls',
		);
	}

	public function create_fedex_parcel_locker(): Simplyin_Method {
		return new Simplyin_Method(
			'fedex_access_point',
			_x(
				'FedEx OnSite Pickup Point',
				'shipping_method_label.fedex',
				'simplyin'
			),
			'fedex',
		);
	}

	public function create_poczta_parcel_locker(): Simplyin_Method {
		return new Simplyin_Method(
			'poczta_access_point',
			_x(
				'Pocztex APM and Pickup Point',
				'shipping_method_label.pocztex',
				'simplyin'
			),
			'poczta',
		);
	}

	public function create_door_delivery(): Simplyin_Method {
		return new Simplyin_Method(
			'door_delivery',
			_x(
				'Courier Delivery to Your Door',
				'shipping_method_label.courier',
				'simplyin'
			),
			'door_delivery',
		);
	}
}
