import API from './Api';

export const searchBook = (params: any) => {
  return API.get('search-books', params);
};

export const reserveBook = (params: any) => {
  let id = params.id;
  return API.post(`/books/${id}/reserve-book`);
};

export const unreserveBook = (params: any) => {
  let id = params.id;
  return API.post(`/books/${id}/un-reserve-book`);
};

export const bookHistory = (params: any) => {
  return API.get('/books-history', params);
};

export const bookHistoryDetails = (params: any) => {
  return API.get(`/books/${params}/book-history`);
};

export const getBookRequestList = (params: any) => {
  return API.get('/book-requests', params);
};

export const getBookRequestDetails = (params: any) => {
  let id = params.id;
  return API.get(`/book-requests/${id}`);
};

export const addBookRequest = (params: any) => {
  return API.post('/book-requests', params);
};

export const putBookRequestDetails = (params: any) => {
  let id = params.id;
  return API.put(`/book-requests/${id}`, params);
};

export const deleteBookRequest = (params: any) => {
  let id = params.id;
  return API.del(`/book-requests/${id}`);
};
