<?php
session_start();
require_once "../../../config.php";
require_once "../../../validation.php";
require_once "../../../Helper.php";
require_once '../../database1.php';

require_once "../../check_admin.php";

if(!isset($_GET['id']) || !is_numeric($_GET['id']))
{
    http_response_code(400);
    echo json_encode(array('error_text' => 'No input found'));
    exit;
}

$id = $_GET['id'];

class start_chat extends database
{
   public function updateAgent($id, $userID)
    {
        return $this->update('tb_chat_customer', ['cl_agent_id' => $userID, 'cl_status' => 'Chat Started'], ['cl_id' => $id]);
    }

}


$obj = new start_chat();   
$chats = $obj->updateAgent($id, $userID);


echo json_encode($chats);