import { router, withPermission } from '../trpc';

/** Lookups the admin fills its pickers from. Settlement methods are filtered to
 * active ones here and NOT in settlementMethods.list — that split is what makes
 * the active switch mean anything: the management screen must still show a
 * retired method, and every picker must not offer it. */
export const configRouter = router({
  settlementMethods: withPermission('settlement-method.read').query(({ ctx }) =>
    ctx.prisma.settlementMethod.findMany({ where: { isActive: true }, orderBy: { sortOrder: 'asc' } }),
  ),

});
