/**
 * Generated by orval v7.10.0 🍺
 * Do not edit manually.
 * Monitoring | v1
 * OpenAPI spec version: 1.0.0
 */
import {
  useMutation,
  useQuery
} from '@tanstack/react-query';
import type {
  DataTag,
  DefinedInitialDataOptions,
  DefinedUseQueryResult,
  MutationFunction,
  QueryClient,
  QueryFunction,
  QueryKey,
  UndefinedInitialDataOptions,
  UseMutationOptions,
  UseMutationResult,
  UseQueryOptions,
  UseQueryResult
} from '@tanstack/react-query';

import type {
  AlarmFireDepartmentDispatchModel,
  CreateDispatchRequest,
  GetAlarmDispatchListParams,
  TableDataResponseModelOfAlarmFireDepartmentDispatchModel,
  UpdateDispatchRequest
} from './client.schemas';

import { customClient } from '../services/http.service';





export const getAlarmDispatchList = (
    params?: GetAlarmDispatchListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfAlarmFireDepartmentDispatchModel>(
      {url: `/api/alarm-dispatches`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetAlarmDispatchListQueryKey = (params?: GetAlarmDispatchListParams,) => {
    return [`/api/alarm-dispatches`, ...(params ? [params]: [])] as const;
    }

    
export const getGetAlarmDispatchListQueryOptions = <TData = Awaited<ReturnType<typeof getAlarmDispatchList>>, TError = unknown>(params?: GetAlarmDispatchListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatchList>>, TError, TData>>, }
) => {

const {query: queryOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getGetAlarmDispatchListQueryKey(params);

  

    const queryFn: QueryFunction<Awaited<ReturnType<typeof getAlarmDispatchList>>> = ({ signal }) => getAlarmDispatchList(params, signal);

      

      

   return  { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatchList>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetAlarmDispatchListQueryResult = NonNullable<Awaited<ReturnType<typeof getAlarmDispatchList>>>
export type GetAlarmDispatchListQueryError = unknown


export function useGetAlarmDispatchList<TData = Awaited<ReturnType<typeof getAlarmDispatchList>>, TError = unknown>(
 params: undefined |  GetAlarmDispatchListParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatchList>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getAlarmDispatchList>>,
          TError,
          Awaited<ReturnType<typeof getAlarmDispatchList>>
        > , 'initialData'
      >, }
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetAlarmDispatchList<TData = Awaited<ReturnType<typeof getAlarmDispatchList>>, TError = unknown>(
 params?: GetAlarmDispatchListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatchList>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getAlarmDispatchList>>,
          TError,
          Awaited<ReturnType<typeof getAlarmDispatchList>>
        > , 'initialData'
      >, }
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetAlarmDispatchList<TData = Awaited<ReturnType<typeof getAlarmDispatchList>>, TError = unknown>(
 params?: GetAlarmDispatchListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatchList>>, TError, TData>>, }
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }

export function useGetAlarmDispatchList<TData = Awaited<ReturnType<typeof getAlarmDispatchList>>, TError = unknown>(
 params?: GetAlarmDispatchListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatchList>>, TError, TData>>, }
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetAlarmDispatchListQueryOptions(params,options)

  const query = useQuery(queryOptions , queryClient) as  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createAlarmDispatch = (
    createDispatchRequest: CreateDispatchRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<AlarmFireDepartmentDispatchModel>(
      {url: `/api/alarm-dispatches`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createDispatchRequest, signal
    },
      );
    }
  


export const getCreateAlarmDispatchMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAlarmDispatch>>, TError,{data: CreateDispatchRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createAlarmDispatch>>, TError,{data: CreateDispatchRequest}, TContext> => {

const mutationKey = ['createAlarmDispatch'];
const {mutation: mutationOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof createAlarmDispatch>>, {data: CreateDispatchRequest}> = (props) => {
          const {data} = props ?? {};

          return  createAlarmDispatch(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateAlarmDispatchMutationResult = NonNullable<Awaited<ReturnType<typeof createAlarmDispatch>>>
    export type CreateAlarmDispatchMutationBody = CreateDispatchRequest
    export type CreateAlarmDispatchMutationError = string

    export const useCreateAlarmDispatch = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAlarmDispatch>>, TError,{data: CreateDispatchRequest}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof createAlarmDispatch>>,
        TError,
        {data: CreateDispatchRequest},
        TContext
      > => {

      const mutationOptions = getCreateAlarmDispatchMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const getAlarmDispatch = (
    id: string,
 signal?: AbortSignal
) => {
      
      
      return customClient<AlarmFireDepartmentDispatchModel>(
      {url: `/api/alarm-dispatches/${id}`, method: 'GET', signal
    },
      );
    }
  

export const getGetAlarmDispatchQueryKey = (id: string,) => {
    return [`/api/alarm-dispatches/${id}`] as const;
    }

    
export const getGetAlarmDispatchQueryOptions = <TData = Awaited<ReturnType<typeof getAlarmDispatch>>, TError = string>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatch>>, TError, TData>>, }
) => {

const {query: queryOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getGetAlarmDispatchQueryKey(id);

  

    const queryFn: QueryFunction<Awaited<ReturnType<typeof getAlarmDispatch>>> = ({ signal }) => getAlarmDispatch(id, signal);

      

      

   return  { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatch>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetAlarmDispatchQueryResult = NonNullable<Awaited<ReturnType<typeof getAlarmDispatch>>>
export type GetAlarmDispatchQueryError = string


export function useGetAlarmDispatch<TData = Awaited<ReturnType<typeof getAlarmDispatch>>, TError = string>(
 id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatch>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getAlarmDispatch>>,
          TError,
          Awaited<ReturnType<typeof getAlarmDispatch>>
        > , 'initialData'
      >, }
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetAlarmDispatch<TData = Awaited<ReturnType<typeof getAlarmDispatch>>, TError = string>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatch>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getAlarmDispatch>>,
          TError,
          Awaited<ReturnType<typeof getAlarmDispatch>>
        > , 'initialData'
      >, }
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetAlarmDispatch<TData = Awaited<ReturnType<typeof getAlarmDispatch>>, TError = string>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatch>>, TError, TData>>, }
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }

export function useGetAlarmDispatch<TData = Awaited<ReturnType<typeof getAlarmDispatch>>, TError = string>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmDispatch>>, TError, TData>>, }
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetAlarmDispatchQueryOptions(id,options)

  const query = useQuery(queryOptions , queryClient) as  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const updateAlarmDispatch = (
    id: string,
    updateDispatchRequest: UpdateDispatchRequest,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/alarm-dispatches/${id}`, method: 'PUT',
      headers: {'Content-Type': 'application/json', },
      data: updateDispatchRequest
    },
      );
    }
  


export const getUpdateAlarmDispatchMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateAlarmDispatch>>, TError,{id: string;data: UpdateDispatchRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof updateAlarmDispatch>>, TError,{id: string;data: UpdateDispatchRequest}, TContext> => {

const mutationKey = ['updateAlarmDispatch'];
const {mutation: mutationOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateAlarmDispatch>>, {id: string;data: UpdateDispatchRequest}> = (props) => {
          const {id,data} = props ?? {};

          return  updateAlarmDispatch(id,data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateAlarmDispatchMutationResult = NonNullable<Awaited<ReturnType<typeof updateAlarmDispatch>>>
    export type UpdateAlarmDispatchMutationBody = UpdateDispatchRequest
    export type UpdateAlarmDispatchMutationError = string

    export const useUpdateAlarmDispatch = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateAlarmDispatch>>, TError,{id: string;data: UpdateDispatchRequest}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof updateAlarmDispatch>>,
        TError,
        {id: string;data: UpdateDispatchRequest},
        TContext
      > => {

      const mutationOptions = getUpdateAlarmDispatchMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const deleteAlarmDispatch = (
    id: string,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/alarm-dispatches/${id}`, method: 'DELETE'
    },
      );
    }
  


export const getDeleteAlarmDispatchMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAlarmDispatch>>, TError,{id: string}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof deleteAlarmDispatch>>, TError,{id: string}, TContext> => {

const mutationKey = ['deleteAlarmDispatch'];
const {mutation: mutationOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteAlarmDispatch>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  deleteAlarmDispatch(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteAlarmDispatchMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAlarmDispatch>>>
    
    export type DeleteAlarmDispatchMutationError = string

    export const useDeleteAlarmDispatch = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAlarmDispatch>>, TError,{id: string}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof deleteAlarmDispatch>>,
        TError,
        {id: string},
        TContext
      > => {

      const mutationOptions = getDeleteAlarmDispatchMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    