<?php
namespace ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Repository;


use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Interfaces\AbstractApiClient;
use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Interfaces\AbstractRepository;
use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\ClassOfService as CosModel;

/**
 *
 * Created by PhpStorm.
 * User: ThurData
 * Date: 29.08.19
 * Time: 08:27
 * Class ClassOfServices
 */
class ClassOfServices extends AbstractRepository
{
    const CUSTOM_KERIO          = 'customMGkerio';
    const KERIO_CONFIG_OPTIONS  = 'kerioConfigurableOptions';
    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
    }

}