<?php

function run_plagiarism_check($submission_id)
{
    $db = \App\Core\Database::getInstance();

    // Simulated API response
    $similarity = rand(5,35);

    $db->prepare("
        INSERT INTO plagiarism_reports(submission_id,similarity_percent,report_link)
        VALUES (?,?,?)
    ")->execute([
        $submission_id,
        $similarity,
        'https://plagiarism.example/report/'.$submission_id
    ]);

    return $similarity;
}
