<?php
declare(strict_types=1);

namespace FiloBlu\Storelocator\Model\Rma;

use FiloBlu\Storelocator\Model\Plugin\Rma\Source\Status;

/**
 *
 */
class Item extends \Magento\Rma\Model\Item
{
	/**
	 * @param $key
	 * @return array|mixed|string|null
	 */
    public function getOrigData($key = null)
    {

        $origData = parent::getOrigData($key);

        if ($key == 'status') {
            if ($this->getStatus() == 'received' && $origData == Status::STATE_RECEIVED_IN_STORE) {
                return 'received';
            }
        }

        return $origData;
    }
}