import {createSelector} from "@reduxjs/toolkit";

export const transRouteTemplatesSelector = (store) => store.transRouteTemplates;

export const selectAllRouteTemplates = createSelector([transRouteTemplatesSelector], (trans) => trans && trans.templates);
export const selectAllActiveRouteTemplates = createSelector([transRouteTemplatesSelector], (trans) => trans && trans.templates?.filter((routeTemplate) => routeTemplate.status === 'active'));
export const selectInboundRouteTemplates = createSelector([transRouteTemplatesSelector], (trans) => trans && trans.templates?.filter((routeTemplate) => routeTemplate.status === 'active' && routeTemplate.type==='inbound'));
export const selectOutboundRouteTemplates = createSelector([transRouteTemplatesSelector], (trans) => trans && trans.templates?.filter((routeTemplate) => routeTemplate.status === 'active' && routeTemplate.type==='outbound'));