<?php

class Autocomplete_model extends Cf_Model
{
    private $endpoint = '/autocomplete';

    public function getClasses($query)
    {
        return json_decode(
            $this->getRestClient()->get("{$this->endpoint}/classes?query=" . urlencode($query)),
            $associative = true,
        );
    }

    public function getVariables($query)
    {
        return json_decode(
            $this->getRestClient()->get("{$this->endpoint}/variables?query=" . urlencode($query)),
            $associative = true,
        );
    }

    public function getInventory($query)
    {
        return json_decode(
            $this->getRestClient()->get("{$this->endpoint}/inventory?query=" . urlencode($query)),
            $associative = true,
        );
    }
}
