/**
 * 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 {
  CreateFireDepartmentRequest,
  FireDepartmentModel,
  GetFireDepartmentListParams,
  TableDataResponseModelOfFireDepartmentModel,
  UpdateFireDepartmentRequest
} from './client.schemas';

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





export const getFireDepartmentList = (
    params?: GetFireDepartmentListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfFireDepartmentModel>(
      {url: `/api/fire-departments`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetFireDepartmentListQueryKey = (params?: GetFireDepartmentListParams,) => {
    return [`/api/fire-departments`, ...(params ? [params]: [])] as const;
    }

    
export const getGetFireDepartmentListQueryOptions = <TData = Awaited<ReturnType<typeof getFireDepartmentList>>, TError = unknown>(params?: GetFireDepartmentListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getFireDepartmentList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetFireDepartmentListQueryResult = NonNullable<Awaited<ReturnType<typeof getFireDepartmentList>>>
export type GetFireDepartmentListQueryError = unknown


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

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

  const queryOptions = getGetFireDepartmentListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createFireDepartment = (
    createFireDepartmentRequest: CreateFireDepartmentRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<FireDepartmentModel>(
      {url: `/api/fire-departments`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createFireDepartmentRequest, signal
    },
      );
    }
  


export const getCreateFireDepartmentMutationOptions = <TError = unknown,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createFireDepartment>>, TError,{data: CreateFireDepartmentRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createFireDepartment>>, TError,{data: CreateFireDepartmentRequest}, TContext> => {

const mutationKey = ['createFireDepartment'];
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 createFireDepartment>>, {data: CreateFireDepartmentRequest}> = (props) => {
          const {data} = props ?? {};

          return  createFireDepartment(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateFireDepartmentMutationResult = NonNullable<Awaited<ReturnType<typeof createFireDepartment>>>
    export type CreateFireDepartmentMutationBody = CreateFireDepartmentRequest
    export type CreateFireDepartmentMutationError = unknown

    export const useCreateFireDepartment = <TError = unknown,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createFireDepartment>>, TError,{data: CreateFireDepartmentRequest}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof createFireDepartment>>,
        TError,
        {data: CreateFireDepartmentRequest},
        TContext
      > => {

      const mutationOptions = getCreateFireDepartmentMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const getFireDepartment = (
    id: string,
 signal?: AbortSignal
) => {
      
      
      return customClient<FireDepartmentModel>(
      {url: `/api/fire-departments/${id}`, method: 'GET', signal
    },
      );
    }
  

export const getGetFireDepartmentQueryKey = (id: string,) => {
    return [`/api/fire-departments/${id}`] as const;
    }

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

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

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

  

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

      

      

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

export type GetFireDepartmentQueryResult = NonNullable<Awaited<ReturnType<typeof getFireDepartment>>>
export type GetFireDepartmentQueryError = string


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

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

  const queryOptions = getGetFireDepartmentQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const updateFireDepartment = (
    id: string,
    updateFireDepartmentRequest: UpdateFireDepartmentRequest,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/fire-departments/${id}`, method: 'PUT',
      headers: {'Content-Type': 'application/json', },
      data: updateFireDepartmentRequest
    },
      );
    }
  


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

const mutationKey = ['updateFireDepartment'];
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 updateFireDepartment>>, {id: string;data: UpdateFireDepartmentRequest}> = (props) => {
          const {id,data} = props ?? {};

          return  updateFireDepartment(id,data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateFireDepartmentMutationResult = NonNullable<Awaited<ReturnType<typeof updateFireDepartment>>>
    export type UpdateFireDepartmentMutationBody = UpdateFireDepartmentRequest
    export type UpdateFireDepartmentMutationError = string

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

      const mutationOptions = getUpdateFireDepartmentMutationOptions(options);

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


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

const mutationKey = ['deleteFireDepartment'];
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 deleteFireDepartment>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  deleteFireDepartment(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteFireDepartmentMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFireDepartment>>>
    
    export type DeleteFireDepartmentMutationError = string

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

      const mutationOptions = getDeleteFireDepartmentMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    