import {getJson, patchJson} from '@/shared/services/httpClient';
import type {MerchantProfile} from '@/features/settings/types/settings';

/**
 * Settings endpoints. See dashboardRepository for the layer's contract.
 *
 * Imperative rather than Endpoint-shaped: a settings record has one state at
 * page load and changes only when the user saves it, so there is nothing for
 * useResource's scope-keyed refetching to do.
 */
export const settingsRepository = {
  profile: () => getJson<MerchantProfile>('/api/settings/profile'),

  updateProfile: (patch: Partial<MerchantProfile>) =>
    patchJson<MerchantProfile>('/api/settings/profile', patch),
};
