import { atom } from 'jotai';
import { ColorMapping } from 'src/application/models/colorsConfig';
import { FrontendConfig } from 'src/application/models/frontendConfig';
import { FeatureFlagContextType } from 'src/contexts/featureFlagServiceContext/featureFlagServiceContext'; // Import FeatureFlagContextType from new context

export const internalGraphQLColorsConfigAtom = atom<ColorMapping | undefined>(undefined);
const internalGraphQLFrontendConfigAtom = atom<FrontendConfig | undefined>(undefined);

export const featureFlagServiceAtom = atom<FeatureFlagContextType | undefined>(undefined); // New atom for FeatureFlagService

export const frontendConfigAtom = atom(
  get => get(internalGraphQLFrontendConfigAtom),
  (_, set, value: FrontendConfig | undefined) => {
    set(internalGraphQLFrontendConfigAtom, value);
  },
);
