1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 
<?php


namespace Manticoresearch\Endpoints;

use Manticoresearch\Request;


/**
 * Class Sql
 * @package Manticoresearch\Endpoints
 */
class Sql extends Request
{
    /**
     * @return mixed|string
     */
    protected $_mode;
    public function getPath()
    {
        return '/sql';
    }

    /**
     * @return mixed|string
     */
    public function getMethod()
    {
        return 'POST';
    }

    /**
     * @return mixed|string
     */
    public function getBody()
    {
        if($this->_mode === 'raw') {
            $return = ['mode=raw'];
            foreach($this->_body as $k=>$v) {
                $return[]= $k.'='.$v;
            }
            return implode('&',$return);
        }else{
            return http_build_query($this->_body);
        }

    }

    public function getMode()
    {
        return $this->_mode;
    }

    public function setMode($mode)
    {
        $this->_mode = $mode;
    }
}