<?php

declare(strict_types=1);

namespace CloudXM\NFe\Services;

use CloudXM\SDK\Services\AbstractUpdateService;

final class UpdateService extends AbstractUpdateService
{
    public function __construct(
        protected \CloudXM\SDK\Contracts\ConfigurationInterface $config
    ) {
        parent::__construct($config);
    }

    public function getUpdateServerUrl(): string
    {
        $site_url = get_site_url();
        $is_dev = $this->isDevelopmentEnvironment($site_url);

        $base_url = $is_dev ? 'https://plugin.cloudxm.com.br/dev' : 'https://plugin.cloudxm.com.br';
        return $base_url . '/woocommerce-cloudxm-nfe/latest.json';
    }
}
