var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/booking/info/model.tsx
var model_exports = {};
__export(model_exports, {
  Context: () => Context,
  Provider: () => Provider,
  walkInData: () => walkInData
});
module.exports = __toCommonJS(model_exports);
var import_utils = require("@pisell/utils");
var import_utils2 = require("./utils");
var walkInData = {
  id: 1,
  nickname: "Select a customer"
};
var defaultState = {};
var { Provider, Context } = (0, import_utils.miniRedux)({
  namespace: "state",
  state: defaultState,
  effects: {
    setClient(state, payload) {
      state.setGlobalState({ client: { ...state.client, ...payload } });
    },
    setService(state, payload) {
      let obj = {};
      if (payload.value) {
        obj.value = (0, import_utils2.formatServiceListByTime)(payload.value);
      }
      state.setGlobalState({
        service: { ...state.service, ...payload, ...obj }
      });
    },
    setDate(state, payload) {
      state.setGlobalState({ date: { ...state.date, ...payload } });
    },
    setPet(state, payload) {
      state.setGlobalState({ pet: { ...state.pet, ...payload } });
    },
    setNotes(state, payload) {
      state.setGlobalState({ notes: { ...state.notes, ...payload } });
    },
    setPetValue(state, payload) {
      state.setGlobalState({
        pet: {
          ...state.pet,
          value: {
            ...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: { ...state.addons, ...payload } });
    }
  },
  reducers: {
    setStateFn(state, payload) {
      return { ...state, ...payload };
    },
    setState(state, payload) {
      return { ...state, ...payload };
    }
  }
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Context,
  Provider,
  walkInData
});
