magento2 – Getting a type error in custom module in Magento 2


I am getting a type error for guest users

Uncaught TypeError: Return value of RegCheckoutModelSimpleNoteGuestManagement::saveSimpleNote() must implement interface RegCheckoutApiDataSimpleNoteInterface, string returned in /var/www/html/reg-dealers/app/code/Reg/Checkout/Model/SimpleNoteGuestManagement.php:58

Stack trace:

My RegCheckoutModelSimpleNoteGuestManagement file :

<?php
namespace RegCheckoutModel;

use MagentoQuoteModelQuoteIdMaskFactory;
use RegCheckoutApiDataSimpleNoteInterface;
use RegCheckoutApiSimpleNoteGuestManagementInterface;
use RegCheckoutApiSimpleNoteManagementInterface;
use RegCheckoutSetupSchemaInformation;
use Exception;
use MagentoFrameworkExceptionCouldNotSaveException;
use MagentoFrameworkExceptionNoSuchEntityException;
use MagentoQuoteApiCartRepositoryInterface;

/**
 * Class SimpleNoteManagement
 */
class SimpleNoteGuestManagement implements SimpleNoteGuestManagementInterface
{
/**
 * Quote repository.
 *
 * @var CartRepositoryInterface
 */
protected $quoteRepository;
protected $customFieldsRepository;

/**
 * SimpleNoteManagement constructor.
 *
 * @param CartRepositoryInterface $quoteRepository
 */
public function __construct(
    QuoteIdMaskFactory $quoteRepository,
    SimpleNoteManagementInterface $customFieldsRepository
)
{
    $this->quoteRepository = $quoteRepository;
    $this->customFieldsRepository = $customFieldsRepository;
}

/**
 * Save simple note number in the quote
 *
 * @param int $cartId
 * @param SimpleNoteInterface $simpleNote
 *
 * @return null|string
 *
 * @throws CouldNotSaveException
 * @throws NoSuchEntityException
 */

public function saveSimpleNote(
    string $cartId,
    SimpleNoteInterface $simpleNote
): SimpleNoteInterface {
    $quoteIdMask = $this->quoteRepository->create()->load($cartId, 'masked_id');
    return $this->customFieldsRepository->saveSimpleNote((int)$quoteIdMask->getQuoteId(), $simpleNote);
}
}

My RegCheckoutApiDataSimpleNoteInterface file

<?php

namespace RegCheckoutApiData;
/**
 * Interface SimpleNoteInterface
*  /
interface SimpleNoteInterface
{
/**
 * Get Simple Note
 *
 * @return string
 */
public function getSimpleNote();
/**
 * Set Simple Note
 *
 * @param string $simpleNote
 *
 * @return void
 */
public function setSimpleNote(string $simpleNote);
}

my Reg/Checkout/Api/SimpleNoteGuestManagementInterface.php file

<?php

namespace RegCheckoutApi;
/**
 * Interface for saving the checkout note to the quote for orders
 *
  * @api
 */
interface SimpleNoteGuestManagementInterface
{
/**
 * @param int $cartId
 * @param AtwixSimpleNoteApiDataSimpleNoteInterface $simpleNote
 *
 * @return string
 */
public function saveSimpleNote(
    string $cartId,
    RegCheckoutApiDataSimpleNoteInterface $simpleNote
);
} 

My SimpleNoteInterface code :

<?php

namespace RegCheckoutApiData;
 /**
 * Interface SimpleNoteInterface
 */
interface SimpleNoteInterface
{
/**
 * Get Simple Note
 *
 * @return string
 */
public function getSimpleNote();
/**
 * Set Simple Note
 *
 * @param string $simpleNote
 *
 * @return void
 */
public function setSimpleNote(string $simpleNote);
}

my file Reg/Checkout/Model/Data/SimpleNote.php

<?php
namespace RegCheckoutModelData;
use RegCheckoutApiDataSimpleNoteInterface;
use RegCheckoutSetupSchemaInformation;
use MagentoFrameworkApiAbstractSimpleObject;
/**
 * Class SimpleNote
 */
class SimpleNote extends AbstractSimpleObject implements 
SimpleNoteInterface
{
/**
 * @inheritdoc
 */
public function getSimpleNote()
{
    return $this->_get(SchemaInformation::ATTRIBUTE_SIMPLE_NOTE);
}
public function setSimpleNote(string $simpleNote)
{
    return $this->setData(SchemaInformation::ATTRIBUTE_SIMPLE_NOTE, $simpleNote);
}
}

my di.xml

<?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="RegCheckoutApiDataSimpleNoteInterface" type="RegCheckoutModelDataSimpleNote" />
<preference for="RegCheckoutApiDataSimpleVehicleInterface" type="RegCheckoutModelDataSimpleAge" />
<preference for="RegCheckoutApiDataSimpleRegisteredInterface" type="RegCheckoutModelDataSimpleKeeper" />
<preference for="RegCheckoutApiSimpleNoteManagementInterface" type="RegCheckoutModelSimpleNoteManagement" />
<preference for="RegCheckoutApiVehicleAgeManagementInterface" type="RegCheckoutModelVehicleAgeManagement" />
<preference for="RegCheckoutApiRegisterKeeperManagementInterface" type="RegCheckoutModelRegisteredKeeperManagement" />
<preference for="RegCheckoutApiSimpleNoteGuestManagementInterface" type="RegCheckoutModelSimpleNoteGuestManagement" />
<virtualType name="MagentoSalesModelResourceModelOrderGrid" type="MagentoSalesModelResourceModelGrid">
    <arguments>
        <argument name="columns" xsi:type="array">
            <item name="simple_note" xsi:type="string">sales_order.simple_note</item>
            <item name="vehicle_age" xsi:type="string">sales_order.vehicle_age</item>
            <item name="registered_keeper" xsi:type="string">sales_order.registered_keeper</item>
        </argument>
    </arguments>
</virtualType>

If any more files is required tell me i have added in question please any one help here.

Any help is appreciated.