<?php
/**
 * Trait ParcelshopDataTrait
 *
 * @package DhlPolska\Point
 */

namespace DhlPolska\Point;

use WC_Order;

/**
 * Shared parcelshop data accessor for order-related views.
 */
trait ParcelshopDataTrait {

	/**
	 * @param WC_Order $order .
	 *
	 * @return array<string, string>
	 */
	private function get_parcelshop_data( WC_Order $order ): array {
		return [
			'id'         => (string) $order->get_meta( CheckoutSavePoint::ORDER_META_PARCELSHOP_ID ),
			'sap'        => (string) $order->get_meta( CheckoutSavePoint::ORDER_META_PARCELSHOP_SAP ),
			'name'       => (string) $order->get_meta( CheckoutSavePoint::ORDER_META_PARCELSHOP_NAME ),
			'postnummer' => (string) $order->get_meta( CheckoutSavePoint::ORDER_META_PARCELSHOP_POSTNUMMER ),
			'zip'        => (string) $order->get_meta( CheckoutSavePoint::ORDER_META_PARCELSHOP_ZIP ),
			'street'     => (string) $order->get_meta( CheckoutSavePoint::ORDER_META_PARCELSHOP_STREET ),
			'city'       => (string) $order->get_meta( CheckoutSavePoint::ORDER_META_PARCELSHOP_CITY ),
			'streetNo'   => (string) $order->get_meta( CheckoutSavePoint::ORDER_META_PARCELSHOP_STREET_NO ),
			'houseNo'    => (string) $order->get_meta( CheckoutSavePoint::ORDER_META_PARCELSHOP_HOUSE_NO ),
		];
	}
}
