<?php
namespace CodeOrders\V1\Rest\Products;

class ProductsEntity
{
    protected $id;
    protected $name;
    protected $description;
    protected $price;

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param mixed $id
     * @return ProductsEntity
     */
    public function setId($id)
    {
        $this->id = $id;
        return $this;
    }

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

    /**
     * @param mixed $name
     * @return ProductsEntity
     */
    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * @param mixed $description
     * @return ProductsEntity
     */
    public function setDescription($description)
    {
        $this->description = $description;
        return $this;
    }

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

    /**
     * @param mixed $price
     * @return ProductsEntity
     */
    public function setPrice($price)
    {
        $this->price = $price;
        return $this;
    }

    public function exchangeArray($data){
        $this->id     = (!empty($data['id'])) ? $data['id'] : null;
        $this->name =  (!empty($data['name'])) ? $data['name'] : null;
        $this->description =  (!empty($data['description'])) ? $data['description'] : null;
        $this->price =  (!empty($data['price'])) ? $data['price'] : null;
    }

    public function getArrayCopy()
    {
        return get_object_vars($this);
    }
}