import { create } from 'zustand';

export interface IBreadcrumbItem {
  label: string;
  href: string;
}

interface OnChangePageModel {
  title?: string;
  breadcrumbs?: IBreadcrumbItem[];
}

interface PageStoreModel {
  title: string;
  breadcrumbs?: IBreadcrumbItem[];
  onChangePage: (data: OnChangePageModel) => void;
}

export const pageStore = create<PageStoreModel>((set) => ({
  title: '',
  breadcrumbs: undefined,
  onChangePage: (data) => {
    set((state) => ({
      ...state,
      ...data,
    }));
  },
}));
