<?php

use api\classes\API_system_sources;

session_start();
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_system_sources.php";

$API_system_sources = new API_system_sources();

if ($API_system_sources->request_method === 'POST') {
    # Enable or disable a module
    $API_system_sources->checkPermissions('admin-sources', 'RW');

    $requiredFields = [
        'source_url' => ['type' => 'string'],
        'source_auth_token' => ['type' => 'string'],
        'source_custom_data' => ['type' => 'json'],
    ];

    $API_system_sources->validateData($requiredFields);

    $API_system_sources->inserveUpdate();
}

