<?php
declare(strict_types=1);
namespace Slivki\Dto\OnlineOrder;
use JsonSerializable;
use OpenApi\Annotations as OA;
final class OrderItemDto implements JsonSerializable
{
/**
* @OA\Property(
* property="name",
* description="Название",
* example="Пицца Маргарита",
* )
*/
private string $name;
/**
* @OA\Property(
* property="quantity",
* description="Количество",
* example="1",
* )
*/
private int $quantity;
/**
* @OA\Property(
* property="purchasePrice",
* type="number",
* format="float",
* description="Цена (BYN)",
* example="10.50",
* )
*/
private float $purchasePrice;
public function __construct(string $name, int $quantity, float $purchasePrice)
{
$this->name = $name;
$this->quantity = $quantity;
$this->purchasePrice = $purchasePrice;
}
public function getName(): string
{
return $this->name;
}
public function getQuantity(): int
{
return $this->quantity;
}
public function getPurchasePrice(): float
{
return $this->purchasePrice;
}
public function jsonSerialize(): array
{
return [
'name' => $this->name,
'quantity' => $this->quantity,
'purchasePrice' => $this->purchasePrice,
];
}
}