<?php

namespace ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Actions;


use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Interfaces\AbstractAction;
use SoapVar;

/**
 *
 * Created by PhpStorm.
 * User: ThurData
 * Date: 05.09.19
 * Time: 13:27
 * Class ClassOfServices
 */
class ClassOfServices extends AbstractAction
{

    public function getAllCos()
    {
        $result = $this->connection->request("GetAllCosRequest");
        $body = $result->getResponseBody();

        return $body['GETALLCOSRESPONSE']['COS'];

    }

    public function getClassOfServiceName($id)
    {
        $params = [
            new SoapVar('<ns1:cos by="id">' . $id . '</ns1:cos>', XSD_ANYXML),
        ];

        $this->connection->request("GetCosRequest", $params);

    }

    public function getCosId($name)
    {
        $params = [
            new SoapVar('<ns1:cos by="name">' . $name . '</ns1:cos>', XSD_ANYXML),
        ];

        $this->connection->request("GetCosRequest", $params);
    }
}