<?php
namespace App\Core;

class Workflow
{
    public static function transitions(): array
    {
        return [

            'submitted' => ['screening'],
            'screening' => ['under_review','rejected'],
            'under_review' => ['reviewed'],
            'reviewed' => ['decision'],
            'decision' => ['revision','camera_ready','rejected'],
            'revision' => ['under_review'],
            'camera_ready' => ['galley'],
            'galley' => ['scheduled'],
            'scheduled' => ['published'],
            'published' => [],
            'rejected' => []

        ];
    }

    public static function canTransition(string $current, string $next): bool
    {
        $map = self::transitions();
        return isset($map[$current]) && in_array($next, $map[$current]);
    }
}
