How to check if at last post and navigate to first post

I have page arrows (Previous and Next ) on every single post however when I reach the last post I want to still keep the Next button which will link to the first post and vice versa if I’m on the first post I want to keep the previous button which would link to last post.

This is my .twig file which currently simply navigates to next or previous post if there is one.

<div class="post-prev">
    {% if post.prev %}
          <a href="{{ post.prev.link }}">Previous</a>
    {% endif %}
</div>
<div class="post-next">
    {% if post.next %}
          <a href="{{ post.next.link }}">Next</a>
    {% endif %}
</div>

and my PHP file which orders posts by date.

$context = Timber::get_context();
$context[ "main_menu" ] = new TimberMenu('main');

$context['page'] = new TimberPost();

$args = array(
    // Get post type project
    'post_type' => 'post',
    // Get all posts
    'posts_per_page' => -1,
    // Order by post date
    'orderby' => array(
        'date' => 'DESC'
    )
);