import {
	WeaTools
} from 'ecCom'

//工作时段
export const getFormInfo = (params) => WeaTools.callApi('/api/hrm/scheduleworktime/getForm?is_multilang_set=true', 'GET', params);
export const getList = (params) => WeaTools.callApi('/api/hrm/scheduleworktime/getSearchList', 'GET', params);
export const save = (params) => WeaTools.callApi('/api/hrm/scheduleworktime/save', 'POST', params);

export const initData = (params = {}) => Promise.all([getFormInfo(params), getList(params)])

//班次设置
export const getShiftsSettingCondition = (params) => WeaTools.callApi('/api/hrm/scheduleshiftsset/getSearchCondition', 'GET', params);
export const getShiftsSettingFormInfo = (params) => WeaTools.callApi('/api/hrm/scheduleshiftsset/getForm?is_multilang_set=true', 'GET', params);
export const getShiftsSettingList = (params) => WeaTools.callApi('/api/hrm/scheduleshiftsset/getSearchList', 'POST', params);
export const saveShiftsSetting = (params) => WeaTools.callApi('/api/hrm/scheduleshiftsset/save', 'POST', params);
export const getShiftsSettingDetialForm = (params) => WeaTools.callApi('/api/hrm/scheduleshiftsset/getDetialForm', 'GET', params);
export const getShiftsSettingDetialList = (params) => WeaTools.callApi('/api/hrm/scheduleshiftsset/getDetialSearchList', 'POST', params);
export const saveShiftsSettingDetial = (params) => WeaTools.callApi('/api/hrm/scheduleshiftsset/saveDetial', 'POST', params);
export const checkDetailWorkTime = (params) => WeaTools.callApi('/api/hrm/scheduleshiftsset/checkDetailWorkTime', 'POST', params);

export const initShiftsSettingData = (params = {}) => Promise.all([
	getShiftsSettingCondition(params),
	getShiftsSettingFormInfo(params)
])

export const initShiftsSettingFormData = (params = {}) => Promise.all([
	getShiftsSettingFormInfo(params)
])

//排班设置
export const getSchedulingSettingCondition = (params) => WeaTools.callApi('/api/hrm/scheduleset/getSearchCondition', 'GET', params);
export const getSchedulingSettingFormInfo = (params) => WeaTools.callApi('/api/hrm/scheduleset/getForm', 'GET', params);
export const getSchedulingSettingList = (params) => WeaTools.callApi('/api/hrm/scheduleset/getSearchList', 'POST', params);
export const saveSchedulingSetting = (params) => WeaTools.callApi('/api/hrm/scheduleset/save', 'POST', params);
export const getSchedulingSettingDetialList = (params) => WeaTools.callApi('/api/hrm/scheduleset/getDetialSearchList', 'POST', params);
export const getSchedulingSettingPersonDetialList = (params) => WeaTools.callApi('/api/hrm/scheduleset/getPersonSearchList', 'POST', params);
export const saveSchedulingSettingDetial = (params) => WeaTools.callApi('/api/hrm/scheduleset/saveDetial', 'POST', params);
export const saveSchedulingSettingPersonDetial = (params) => WeaTools.callApi('/api/hrm/scheduleset/savePerson', 'POST', params);
export const getCalendarData = (params) => WeaTools.callApi('/api/hrm/scheduleset/getCalendar', 'POST', params);
export const getCancelForm = (params) => WeaTools.callApi('/api/hrm/scheduleset/getCancelForm', 'GET', params);

export const initSchedulingSettingFormData = (params = {}) => Promise.all([
	getSchedulingSettingFormInfo(params),
	getSchedulingSettingDetialList(params)
])