<?php

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


require_once '../../core/employee_auth.php';
EmployeeAuth::check('manage_providers');

$data = Request::post();

Validator::required($data, [
    'provider_id',
    'category_id',
    'sub_category_id'
]);

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

$query = "

INSERT INTO provider_service_categories
(provider_id,category_id,sub_category_id)

VALUES

(:provider_id,:category_id,:sub_category_id)

";

$conn->prepare($query)->execute([
    ':provider_id' => $data['provider_id'],
    ':category_id' => $data['category_id'],
    ':sub_category_id' => $data['sub_category_id']
]);

Response::success([], "Service assigned");