import { useMutation, useQueryClient } from '@tanstack/react-query'
import { createSeccion } from '../api/createSeccion'
import type { CreateSeccionRequest } from '../types'

export function useCreateSeccion() {
  const queryClient = useQueryClient()
  return useMutation({
    mutationFn: (payload: CreateSeccionRequest) => createSeccion(payload),
    onSuccess: () => {
      queryClient.invalidateQueries({ queryKey: ['secciones'] })
    },
  })
}
