<?php

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


use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Interfaces\ApiService;
use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\Domain;

/**
 *
 * Created by PhpStorm.
 * User: ThurData
 * Date: 02.10.19
 * Time: 14:39
 * Class DeleteDomainAlias
 */
class DeleteDomainAlias extends ApiService
{

    public function process()
    {

        $domain = new Domain();
        $domain->setId($this->formData['id']);

        $result = $this->api->domain->delete($domain);

        if(!$result)
        {
            $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
            return false;
        }

        return true;
    }

}