public function __construct(int $amount, string $currency, int $precision = self::DEFAULT_PRECISION)
{
if ($amount < 0) {
throw InvalidArgumentException::negativePriceAmount($amount);
}
if ($precision < 0) {
throw InvalidArgumentException::negativePricePrecision($precision);
}
if (!Currencies::isValid($currency)) {
throw InvalidArgumentException::invalidCurrency($currency);
}
$this->amount = $amount;
$this->currency = $currency;
$this->precision = $precision;
}