<?php

namespace Saswp;

function property_address_shortcode() {
	$settings         = new \Saswp\Settings();
	$property         = new \Saswp\Repository\PropertyRepository();
	$propertyLocation = $property->get( $settings->get( 'sas_one_property_page_id' ) )->getPropertyLocation();
	if ( $propertyLocation->state && $propertyLocation->country ) {
		$location = esc_html( $propertyLocation->state ) . ', ' . esc_html( $propertyLocation->country );

		return '<div class="property-address text-disabled"><i class="fa-solid fa-location-dot w-auto"></i>&nbsp;' . $location . '</div>';
	} else {
		return '<div class="property-address" data-shortcode="property_address"></div>';
	}
}

?>
