import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { formatServiceListByTime } from "./utils.js";
import { miniRedux } from "@pisell/utils";
//#region src/components/booking/info/model.tsx
const walkInData = {
	id: 1,
	nickname: "Select a customer"
};
const { Provider, Context } = miniRedux({
	namespace: "state",
	state: {},
	effects: {
		setClient(state, payload) {
			state.setGlobalState({ client: _objectSpread2(_objectSpread2({}, state.client), payload) });
		},
		setContactsInfo(state, payload) {
			state.setGlobalState({ contacts_info: _objectSpread2(_objectSpread2({}, state.contacts_info), payload) });
		},
		setService(state, payload) {
			let obj = {};
			if (payload.value) obj.value = formatServiceListByTime(payload.value);
			state.setGlobalState({ service: _objectSpread2(_objectSpread2(_objectSpread2({}, state.service), payload), obj) });
		},
		setPaymentPaid(state, payload) {
			state.setGlobalState({ paymentPaid: _objectSpread2(_objectSpread2({}, state.paymentPaid), payload) });
		},
		setDate(state, payload) {
			state.setGlobalState({ date: _objectSpread2(_objectSpread2({}, state.date), payload) });
		},
		setPet(state, payload) {
			state.setGlobalState({ pet: _objectSpread2(_objectSpread2({}, state.pet), payload) });
		},
		setNotes(state, payload) {
			state.setGlobalState({ notes: _objectSpread2(_objectSpread2({}, state.notes), payload) });
		},
		setPetValue(state, payload) {
			state.setGlobalState({ pet: _objectSpread2(_objectSpread2({}, state.pet), {}, {
				value: _objectSpread2(_objectSpread2({}, state.pet.value), payload),
				edit: false
			}) });
		},
		setStatus(state, payload) {
			let _val = { appointment_status: payload };
			if (payload === "cancelled") _val.disabledEdit = true;
			else _val.disabledEdit = false;
			state.setGlobalState(_val);
		},
		setActiveCartId(state, payload) {
			state.setGlobalState(payload);
		},
		setAddons(state, payload) {
			state.setGlobalState({ addons: _objectSpread2(_objectSpread2({}, state.addons), payload) });
		}
	},
	reducers: {
		setStateFn(state, payload) {
			return _objectSpread2(_objectSpread2({}, state), payload);
		},
		setState(state, payload) {
			return _objectSpread2(_objectSpread2({}, state), payload);
		}
	}
});
//#endregion
export { Context, Provider, walkInData };
