<?php
/**
 * Class DeleteRessource
 * 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\Ressource;

class DeleteRessource extends ApiService
{

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

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

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

        return $result;
    }

}