import api from './axios'

// Program API endpoints
export const fetchPrograms = (params) => api.get('admin/programs/all', { params })
export const createProgram = (payload) => api.post('admin/programs/add', payload)
export const updateProgram = (id, payload) => api.put(`admin/programs/${id}`, payload)
export const deleteProgram = (id, params = {}) => api.delete(`admin/programs/${id}`, { params })
export const getProgram = (id, params = {}) => api.get(`admin/programs/${id}`, { params })
export const getProgramUpdatePreview = (id, language = 'en') =>
  api.get(`admin/programs/${id}/update-preview`, { params: { language } })
export const getProgramResetPreview = (id, language = 'en') =>
  api.get(`admin/programs/${id}/reset-preview`, { params: { language } })
// Override a global program for current franchisee
export const overrideProgram = (id, payload) => api.post(`admin/programs/${id}/override`, payload)
export const reorderPrograms = (payload) => api.post('admin/programs/reorder', payload)
// Translate programs
export const translateProgramsApi = (payload) => api.post('admin/translate', payload)
