import { api } from "src/boot/axios";

export const getGuestPermissions = async () => {
  const { data } = await api.get("/permissions-by-type/guest");
  return data.payload;
};

export const getUserPermissions = async () => {
  const { data } = await api.get("/permissions-by-type");
  return data.payload;
};

export const getPermissionCatalog = async () => {
  const { data } = await api.get("/permission-no-tree");
  return data.payload;
};

export const getPermissionsByUserType = async (userTypeId) => {
  const { data } = await api.get(`/permissions-by-type/${userTypeId}`);
  return data.payload;
};

export const updatePermissionsByUserType = async (userTypeId, permissions) => {
  const { data } = await api.put(`/permissions-by-type/${userTypeId}`, {
    permissions,
  });

  return data.payload;
};
