Zend certified PHP/Magento developer

Retrieve salable quantity value and conditionally display text in Product Detail View Magento 2.4

I have created a custom block that appears below the price in the product detail page.

I did this by creating the following file

app/design/frontend/vendor/theme/Magento_Catalog/layout/catalog_product_view.xml

with the contents

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="product.info.sku" remove="true" />
        <referenceContainer name="product.info.main">
            <block class="MagentoFrameworkViewElementTemplate" name="stockstatus.text" template="Magento_Catalog::view/stockstatus.phtml" after="product.info.price"/>
        </referenceContainer>
    </body>
</page>

What i would like to display in this block is the following:

If the salable qty is greater than 0 then display “Item is in stock”

else

If salable qty <= 0 then display “Item instock at supplier, Lead time: {lead_time}”

{lead_time} is a custom attribute created in admin.

I did try the following in the stockstatus.phtml file:

<?php $_product = $block->getProduct() ?>

<?php if ($block->getStockQtyLeft()>0) : ?>
    <div class="availability only" title="Item in stock">
        <p>This item is in stock.</p>
    </div>
<?php else: ?>
    <div class="availability only" title="Item not in stock">
        <p>Item instock at the supplier. Lead time: <?php echo $_product->getResource()->getAttribute('lead_time')->getFrontend()->getValue($_product); ?></p>
    </div>
<?php endif ?>

However I got the following error:

Item instock at the supplier. Lead time: Error: Call to a member function getResource() on null