import api from 'src/api';

export const createSchedule = async (scheduleData) => {
  const { data } = await api.post('/schedule', scheduleData);
  return data.payload;
};

export const updateScheduleStatus = async (id, status) => {
  const { data } = await api.patch(`/schedule/${id}/status`, { status });
  return data.payload;
};

export const getClientProviderBlocks = async (clientId, providerId) => {
  const { data } = await api.get('/schedule/client-provider-blocks', {
    params: {
      client_id: clientId,
      provider_id: providerId,
    },
  });

  return data.payload;
};

export const cancelSchedule = async (id, cancelText) => {
  const { data } = await api.patch(`/schedule/${id}/cancel`, { cancel_text: cancelText })
  return data.payload
}
