<?php

declare(strict_types=1);

namespace App\Service\Soap\Api;

use App\Service\Soap\Client\ClientFactory;

abstract class ServiceAbstract
{
    protected \SoapClient $client;

    /**
     * @throws \SoapFault
     */
    public function __construct(ClientFactory $clientFactory, protected string $host)
    {
        $this->client = $clientFactory->getClientForService($this);
    }

    /**
     * @return string[]
     */
    public function __getFunctions(): array
    {
        return $this->client->__getFunctions();
    }

    public function getWsdlPath(): string
    {
        return sprintf('%s?wsdl', $this->host);
    }
}
