import { adminProcedure, createTRPCRouter } from "../trpc.js";
import {
  listSystemRoleConfigs,
  systemRoleConfigUpdateInputSchema,
  updateSystemRoleConfig,
} from "./system-role-config-procedure-support.js";

export const systemRoleConfigRouter = createTRPCRouter({
  /** List all role configs (sorted by sortOrder) */
  list: adminProcedure.query(({ ctx }) => listSystemRoleConfigs(ctx)),

  /** Update a role's default permissions, label, description, and color */
  update: adminProcedure
    .input(systemRoleConfigUpdateInputSchema)
    .mutation(({ ctx, input }) => updateSystemRoleConfig(ctx, input)),
});
