<?php

declare (strict_types=1);
namespace DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Service\Ucp\Integration;

/**
 * Provides policy page links from WordPress/WooCommerce settings.
 *
 * @phpstan-type Link array{type: string, url: string}
 */
final class PolicyLinkProvider
{
    /**
     * @return list<Link>
     */
    public function get_policy_links(): array
    {
        $links = [];
        $privacy_url = \get_privacy_policy_url();
        if ('' !== $privacy_url) {
            $links[] = ['type' => 'privacy_policy', 'url' => $privacy_url];
        }
        $terms_page_id = \wc_terms_and_conditions_page_id();
        if ($terms_page_id > 0) {
            $terms_url = \get_permalink($terms_page_id);
            if (\is_string($terms_url) && '' !== $terms_url) {
                $links[] = ['type' => 'terms_of_service', 'url' => $terms_url];
            }
        }
        return $links;
    }
}
