import api from "src/api";

const base = "/franchisee/permissions/groups";

export const getUserTypes = async () => (await api.get(base)).data.payload;
export const createUserType = async (payload) => (await api.post(base, payload)).data.payload;
export const updateUserType = async (id, payload) => (await api.put(`${base}/${id}`, payload)).data.payload;
export const deleteUserType = async (id) => (await api.delete(`${base}/${id}`)).data.payload;
export const getUserTypePermissions = async (id) => (await api.get(`${base}/${id}/permissions`)).data.payload;
export const updateUserTypePermissions = async (id, permissions) =>
  (await api.put(`${base}/${id}/permissions`, { permissions })).data.payload;
