<?php

function allowed_next_stage(string $current): array
{
    $map = [
        'submitted' => ['screening'],
        'screening' => ['reviewing','rejected'],
        'reviewing' => ['revision','decision'],
        'revision'  => ['reviewing','decision'],
        'decision'  => ['production','rejected'],
        'production'=> ['published'],
        'published' => []
    ];

    return $map[$current] ?? [];
}

function can_transition(string $current, string $next): bool
{
    return in_array($next, allowed_next_stage($current));
}
