<?php

namespace KupShop\GraphQLBundle\ApiPos\Types\Purchase;

use KupShop\GraphQLBundle\ApiPos\Types\Collection\PosSerialNumberCollection;
use KupShop\GraphQLBundle\ApiPos\Types\Warehouse\PosStoreItemCollection;
use KupShop\GraphQLBundle\ApiPos\Types\Warehouse\PosWarehouseCollection;
use TheCodingMachine\GraphQLite\Annotations\Field;
use TheCodingMachine\GraphQLite\Annotations\Type;

/**
 * @Type()
 */
class PosPurchaseItem
{
    private $id;
    private $uuid;
    private $title;
    private $variationTitle;
    private $idProduct;
    private $idVariation;
    private $pieces;
    private $vat;
    private $piecePrice;
    private $stockIn;
    private $code;
    private $photo;
    private $ean;
    private $stores;
    private $idCharge;
    private $warehouse;
    private $serial_number_require;
    private $serial_number_check;

    public function __construct(array $data)
    {
        $this->uuid = $data['uuid'] ?? null;
        $this->idCharge = $data['id_charge'] ?? null;
        $this->id = $data['id'] ?? null;
        $this->title = $data['title'] ?? null;
        $this->idProduct = $data['id_product'] ?? null;
        $this->idVariation = $data['id_variation'] ?? null;
        $this->pieces = $data['pieces'] ?? null;
        $this->vat = $data['vat'] ?? null;
        $this->piecePrice = $data['piece_price'] ?? null;
        $this->code = $data['code'] ?? null;
        $this->photo = $data['photo'] ?? null;
        $this->ean = $data['ean'] ?? null;
        $this->stores = $data['stores'] ?? null;
        $this->warehouse = $data['warehouse'] ?? null;
        $this->stockIn = $data['stockIn'] ?? null;
        $this->variationTitle = $data['variationTitle'] ?? null;
        $this->serial_number_require = $data['serial_number_require'] ?? null;
        $this->serial_number_check = $data['serial_number_check'] ?? null;
    }

    /**
     * @Field()
     */
    public function getTitle(): ?string
    {
        return $this->title;
    }

    /**
     * @Field()
     */
    public function getIdProduct(): ?string
    {
        return $this->idProduct;
    }

    /**
     * @Field()
     */
    public function getIdVariation(): ?string
    {
        return $this->idVariation;
    }

    /**
     * @Field()
     */
    public function getPieces(): string
    {
        return $this->pieces;
    }

    /**
     * @Field()
     */
    public function getVat(): ?string
    {
        return $this->vat;
    }

    /**
     * @Field()
     */
    public function getCode(): ?string
    {
        return $this->code;
    }

    /**
     * @Field()
     */
    public function getEan(): ?string
    {
        return $this->ean;
    }

    /**
     * @Field()
     */
    public function getPhoto(): ?string
    {
        return $this->photo;
    }

    /**
     * @Field()
     */
    public function getPiecePrice(): string
    {
        return $this->piecePrice;
    }

    /**
     * @Field()
     */
    public function getStores(): ?PosStoreItemCollection
    {
        return $this->stores;
    }

    /**
     * @Field()
     */
    public function getWarehouse(): ?PosWarehouseCollection
    {
        return $this->warehouse;
    }

    /**
     * @Field()
     */
    public function getStockIn(): ?string
    {
        return $this->stockIn;
    }

    /**
     * @Field
     */
    public function getId(): ?string
    {
        return $this->id;
    }

    /**
     * @Field
     */
    public function getUuid(): ?string
    {
        return $this->uuid;
    }

    /**
     * @Field
     */
    public function getVariationTitle(): ?string
    {
        return $this->variationTitle;
    }

    /**
     * @Field
     */
    public function getIdCharge(): ?int
    {
        return $this->idCharge;
    }

    /**
     * @Field
     */
    public function getSerialNumberRequire(): bool
    {
        return $this->serial_number_require === 'Y';
    }

    /**
     * @Field
     */
    public function getSerialNumbers(): ?PosSerialNumberCollection
    {
        return $this->serial_number_check;
    }
}
