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


class deleteValues extends database{
	public function index($where)
	{
		return $this->update('tb_product_subcategory_values_filter', ['cl_deleted_at' => date('Y-m-d H:i:s')], $where);
	}
}

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

$where['cl_id'] = $id = $_POST['id'];

if(trim($id) == '')
{
    http_response_code(500);
	echo json_encode(array('error_text' => 'Something Went Wrong'));
	exit;
}

$helper = new Helper();
$validation = new validation();





$unsetFields = array('cl_id','cl_deleted_at');
$data = $validation->unsetValues($unsetFields, $data);
$data = $validation->setColumnPrefix($data);

$obj = new deleteValues();

$res = $obj->index($where);
if(!$res)
{
	http_response_code(401);
	echo json_encode(array('error_text' => 'Something Went Wrong'));
	exit;
}

session_start();
$_SESSION['error_message'] = 'Values Deleted Successfully';
$_SESSION['error_type'] = 'success';

http_response_code(200);
echo json_encode(array('message' => 'Values Deleted Successfully'));
exit;