import { routingTable } from "@/router/constants/routing-table";

export function getDestination(sourcePageName, navigationScenario) {
    const table = routingTable();

    const pageEntry = table.find((entry) => entry.pageName === sourcePageName);

    const map = pageEntry?.maps?.find((map) => map.scenario === navigationScenario);

    if (!map || map?.filter === false) {
        return null;
    }

    return {
        ...map.destinationPageData,
        params: map.params,
    };
}
