<?php
/**
 * Class DeleteAccount
 * User: Nessandro
 * Date: 2019-09-17
 * Time: 17:12
 * @package ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Services\Create
 */

namespace ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Services\Delete;


use ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Interfaces\ApiService;
use ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\Account;

class DeleteAccount extends ApiService
{

    /**
     * remove account in APi
     *
     * @return bool|mixed
     */
    public function process()
    {
        $account = new Account();
        $account->setId($this->formData['id']);

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

        /**
         * problem with remove account
         */
        if(!$result)
        {
            $this->setError($this->api->account->getError());
            return false;
        }

        return $result;
    }

}