<?php
require_once __DIR__ . '/helpers.php';

$payload = delivery_json_input();
$tenant = delivery_load_tenant();
$manifest = delivery_manifest($payload);
$files = delivery_unique_files($payload['files'] ?? []);
$wsResult = delivery_written_scheme_result($manifest, $tenant);
$files = array_merge($files, $wsResult['files']);

delivery_response([
    'ok' => true,
    'files' => delivery_unique_files($files),
    'warnings' => $wsResult['warnings'],
]);
