/**
 * Net / gross / VAT price display — shared between quote listings.
 */
import React from 'react';
import { __ } from '@wordpress/i18n';

interface PriceDisplayProps {
	/** Price excluding VAT. */
	net: number;
	/** Price including VAT. */
	gross: number;
	/** Whether the price includes VAT (show gross row when true). */
	hasVAT: boolean;
	/** Currency symbol (default '£'). */
	currency?: string;
}

function PriceDisplayInner({ net, gross, hasVAT, currency = '£' }: PriceDisplayProps) {
	return (
		<>
			<div style={{ fontWeight: 600 }}>
				{currency}
				{net.toFixed(2)} {__('ex VAT', 'parcel2go-shipping')}
			</div>
			{hasVAT && (
				<div style={{ fontSize: 12, color: '#646970' }}>
					{currency}
					{gross.toFixed(2)} {__('inc VAT', 'parcel2go-shipping')}
				</div>
			)}
		</>
	);
}

const PriceDisplay = React.memo(PriceDisplayInner);
export default PriceDisplay;
