const functions = require('firebase-functions');
const api = require('./method');
/**
* Edit an existing booking record on SimplyBook
*
* @function
*
* @requires module:method/editBooking
*
*
* @param {number} bookingID - Booking ID of the booking record.
* @param {number} eventID - ID of the service used for the booking record.
* @param {number} performerID - ID of the service provider used for the booking record.
* @param {number} clientID - ID of the client the booking record was under.
* @param {string} date - The new date of the booking record, e.g. '2020-03-06'.
* @param {string} startTime - The new booking start time of the booking record, e.g. '15:30:00'.
*
* @return {object} An object containing data related to the booking record.
*
* @example
* editSimplybookBooking({
* "bookingID": 302,
* "eventID": 1,
* "performerID": 1,
* "clientID": 316,
* "date": "2020-03-05",
* "startTime": "15:30:00"
* });
*/
exports.editSimplybookBooking = functions.region('asia-east2').https
.onCall(({bookingID, eventID, performerID, clientID, date, startTime}) => {
return api.editBooking(
bookingID,
eventID,
performerID,
clientID,
date,
startTime
);
});