<?php

namespace FCA\StockApi\Document\Offer;

use FCA\StockApi\Document\Base;

class Equipment extends Base
{
    /**
     * @var string
     */
    protected $code;

    /**
     * @var string
     */
    protected $type;

    /**
     * @var string
     */
    protected $name;

    /**
     * @var null|string
     */
    protected $price;

    /**
     * Equipment constructor.
     * @param $equipment
     * @throws \FCA\StockApi\Exception\ApiException
     */
    public function __construct($equipment)
    {
        $requiredKeys = ['code', 'type', 'name', 'price'];
        $this->checkKeys($requiredKeys, $equipment);

        $this->code = $equipment['code'];
        $this->type = $equipment['type'];
        $this->name = $equipment['name'];
        $this->price = $equipment['price'];
    }

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

    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @return null|string
     */
    public function getPrice()
    {
        return $this->price;
    }
}
