<?php

require_once '../../core/api_bootstrap.php';
require_once '../../core/employee_auth.php';

EmployeeAuth::check('manage_employees');

$data = Request::post();

try {

Validator::required($data,['id']);

$db = new Database();
$conn = $db->connect();

$conn->prepare("

DELETE FROM employees
WHERE id=:id

")->execute([
':id'=>$data['id']
]);

Response::success([],"Employee deleted");

}
catch(Exception $e){

Logger::log("system.log",$e->getMessage());

Response::error("Server error",500);

}
