import api from "@shared/api"

interface IUseSubmitSilenceApplyParams {
	onSuccess?: (data: unknown) => void
	onError?: (error: unknown) => void
}

export const useSubmitSilenceApply = ({
	onSuccess,
	onError,
}: IUseSubmitSilenceApplyParams = {}) => {
	// NOTE: Endpoint types will be available after running `bun run gen:api-types`
	return api.useMutation(
		"post",
		"/api/tasks/silence-apply/" as "/api/tasks/silence-remove/",
		{
			onSuccess: (data) => {
				onSuccess?.(data)
			},
			onError: (error) => {
				onError?.(error)
			},
		},
	)
}
