import httpRequest from "@/utils/httpRequest";
import { HOTEL_ORDER_PATH as prefix } from "../AppPath";

/**
 * 营业时段管理API服务
 */
export default class HotelBusinessHoursService {
	/** 分页查询营业时段列表 */
	page(params) {
		return httpRequest({
			url: prefix + "/config/businessHours/list",
			method: "get",
			params,
		});
	}

	/** 获取营业时段列表（全部） */
	all() {
		return httpRequest({
			url: prefix + "/config/businessHours/all",
			method: "get",
		});
	}

	/** 获取启用的营业时段 */
	enabled() {
		return httpRequest({
			url: prefix + "/config/businessHours/enabled",
			method: "get",
		});
	}

	/** 查询营业时段详情 */
	queryById(id) {
		return httpRequest({
			url: prefix + "/config/businessHours/queryById",
			method: "get",
			params: { id },
		});
	}

	/** 新增/编辑营业时段 */
	save(data) {
		return httpRequest({
			url: prefix + "/config/businessHours/save",
			method: "post",
			data,
		});
	}

	/** 切换状态 */
	toggle(id) {
		return httpRequest({
			url: prefix + "/config/businessHours/toggle/" + id,
			method: "post",
		});
	}

	/** 删除营业时段 */
	delete(id) {
		return httpRequest({
			url: prefix + "/config/businessHours/delete/" + id,
			method: "post",
		});
	}
}
