<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require(APPPATH.'/libraries/RestController.php');
class Restaurantapi extends \chriskacerguis\RestServer\RestController{
    public function __construct() {
        parent::__construct();
        $this->load->model('restaurantapi_model');
        $this->load->model('Mobileapp_model');
    }
    public function index(){
        $r = array(
            'key' => 'method issue'
        );
        $this->response($r);  
    }
    public function categories_get(){
        $business_id = $this->input->get('businessid');
        $r = $this->restaurantapi_model->getCategories($business_id);
        $this->response($r);
    }
    public function category_product_get(){
        $business_id = $this->input->get('businessid');
        $category = $this->input->get('category');
        $r = $this->restaurantapi_model->getCategoryProduct($business_id,$category);
        $this->response($r);
    }
    public function customers_get(){
        $business_id = $this->input->get('businessid');
        $r = $this->restaurantapi_model->getCustomers($business_id);
        $this->response($r);
    }
    public function add_customer_post(){
        $r = $this->restaurantapi_model->addCustomer();
        $this->response($r);
    }
    public function staff_get(){
        $r = $this->restaurantapi_model->getStaff();
        $this->response($r);
    }
    public function cities_get(){
        $r = $this->restaurantapi_model->getCities();
        $this->response($r);
    }
    public function place_order_post(){
        $r = $this->restaurantapi_model->placeOrder();
        $this->response($r); 
    }
    public function running_orders_get(){
        $r = $this->restaurantapi_model->runningOrder();
        $this->response($r);
    }
    public function getting_orders_with_balance_get(){
        $r = $this->restaurantapi_model->gettingOrdersWithBalance();
        $this->response($r);
    }
    public  function order_details_get(){
        $r = $this->restaurantapi_model->orderDetails();
        $this->response($r);
    }
    public  function getting_recent_invoices_get(){
        $r = $this->restaurantapi_model->getting_recent_invoices();
        $this->response($r);
    }
    public  function create_invoice_post(){
        $r = $this->restaurantapi_model->createInvoice();
        $this->response($r);
    }
    public  function cancel_order_post(){
        $r = $this->restaurantapi_model->cancelOrder();
        $this->response($r);
    } 
    
    public  function delete_order_row_post(){
        $r = $this->restaurantapi_model->deleteOrderRow();
        $this->response($r);
    }  
}

