<?php
namespace ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Repository;


use ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Interfaces\AbstractApiClient;
use ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Interfaces\AbstractRepository;
use ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\ClassOfService as CosModel;

/**
 *
 * Created by PhpStorm.
 * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
 * Date: 29.08.19
 * Time: 08:27
 * Class ClassOfServices
 */
class ClassOfServices extends AbstractRepository
{
    const CUSTOM_ZIMBRA          = 'customMGzimbra';
    const ZIMBRA_CONFIG_OPTIONS  = 'zimbraConfigurableOptions';
    const CLASS_OF_SERVICE_QUOTA = 'cosQuota';

    public function all()
    {
        $result = $this->getClient()->classOfServices->getAllCos();
        foreach ($result as $item)
        {
            $cos = new CosModel($item);
            $tmp[$cos->getId()] = $cos;
        }
        return $tmp;
    }

    public function asArrayList()
    {
        $result = $this->getClient()->classOfServices->getAllCos();
        foreach ($result as $item)
        {
            $tmp[] = $item['NAME'];
        }

        return $tmp;
    }

    public function byName($name)
    {
        //todo add support
    }

    public function byId($id)
    {
        //todo add support
    }

}