import { create } from "zustand";

export type TextDefaults = {
  fontFamily: string;
  fontWeight: string;
  fontSize: number;
  fill: string;
  opacity: number;
  letterSpacing: number;
  wordSpacing: number;
};

type TextDefaultsStoreType = {
  defaults: TextDefaults;
  updateDefaults: (updates: Partial<TextDefaults>) => void;
};

export const useTextDefaultsStore = create<TextDefaultsStoreType>((set) => ({
  defaults: {
    fontFamily: "irancell",
    fontWeight: "600",
    fontSize: 16,
    fill: "#000000",
    opacity: 100,
    letterSpacing: 0,
    wordSpacing: 10,
  },
  updateDefaults: (updates) =>
    set((state) => ({
      defaults: { ...state.defaults, ...updates },
    })),
}));
