<?php

declare(strict_types=1);

namespace KupShop\GraphQLBundle\ApiShared\Types\Product;

use TheCodingMachine\GraphQLite\Annotations\Field;
use TheCodingMachine\GraphQLite\Annotations\Type;

#[Type]
class ProductBatch
{
    public function __construct(private readonly array $productBatch)
    {
    }

    #[Field(description: 'Kód šarže')]
    public function getCode(): string
    {
        return $this->productBatch['code'] ?? '';
    }

    #[Field(description: 'Datum spotřeby')]
    public function getDateExpiry(): string
    {
        return $this->productBatch['date_expiry'] ?? '';
    }

    #[Field(description: 'Množství na skladě s touto šarží')]
    public function getBatchQuantity(): ?float
    {
        return $this->productBatch['batch_quantity'] ?? 0;
    }
}
