import { mutationOptions } from '@tanstack/react-query';
import { invalidateOrganizerData } from '@/lib/query-invalidation';
import { createOrganizer, softDeleteOrganizer, updateOrganizer } from './service';
import type { OrganizerMutationPayload } from './types';

export const createOrganizerMutation = mutationOptions({
  mutationFn: (data: OrganizerMutationPayload) => createOrganizer(data),
  onSuccess: () => invalidateOrganizerData()
});

export const updateOrganizerMutation = mutationOptions({
  mutationFn: ({ id, values }: { id: string; values: OrganizerMutationPayload }) =>
    updateOrganizer(id, values),
  onSuccess: () => invalidateOrganizerData()
});

export const softDeleteOrganizerMutation = mutationOptions({
  mutationFn: (id: string) => softDeleteOrganizer(id),
  onSuccess: () => invalidateOrganizerData()
});
