<?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',
    'pincode_id'
]);

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

$query = "

INSERT INTO provider_service_areas
(provider_id,pincode_id)

VALUES

(:provider_id,:pincode_id)

";

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

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