import { create } from "zustand";

export type PencilDefaults = {
  stroke: string;
  strokeWidth: number;
};

type PencilDefaultsStoreType = {
  defaults: PencilDefaults;
  updateDefaults: (updates: Partial<PencilDefaults>) => void;
};

export const usePencilDefaultsStore = create<PencilDefaultsStoreType>((set) => ({
  defaults: {
    stroke: "#000000",
    strokeWidth: 3,
  },
  updateDefaults: (updates) =>
    set((state) => ({
      defaults: { ...state.defaults, ...updates },
    })),
}));
