/**
 * 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 {
  CreateFireDepartmentAccessRequest,
  FireDepartmentAccessModel,
  GetFireDepartmentAccessListParams,
  TableDataResponseModelOfFireDepartmentAccessModel,
  UpdateFireDepartmentAccessRequest
} from './client.schemas';

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





export const getFireDepartmentAccessList = (
    params?: GetFireDepartmentAccessListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfFireDepartmentAccessModel>(
      {url: `/api/fire-department-accesses`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetFireDepartmentAccessListQueryKey = (params?: GetFireDepartmentAccessListParams,) => {
    return [`/api/fire-department-accesses`, ...(params ? [params]: [])] as const;
    }

    
export const getGetFireDepartmentAccessListQueryOptions = <TData = Awaited<ReturnType<typeof getFireDepartmentAccessList>>, TError = unknown>(params?: GetFireDepartmentAccessListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getFireDepartmentAccessList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetFireDepartmentAccessListQueryResult = NonNullable<Awaited<ReturnType<typeof getFireDepartmentAccessList>>>
export type GetFireDepartmentAccessListQueryError = unknown


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

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

  const queryOptions = getGetFireDepartmentAccessListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createFireDepartmentAccess = (
    createFireDepartmentAccessRequest: CreateFireDepartmentAccessRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<FireDepartmentAccessModel>(
      {url: `/api/fire-department-accesses`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createFireDepartmentAccessRequest, signal
    },
      );
    }
  


export const getCreateFireDepartmentAccessMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createFireDepartmentAccess>>, TError,{data: CreateFireDepartmentAccessRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createFireDepartmentAccess>>, TError,{data: CreateFireDepartmentAccessRequest}, TContext> => {

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

          return  createFireDepartmentAccess(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateFireDepartmentAccessMutationResult = NonNullable<Awaited<ReturnType<typeof createFireDepartmentAccess>>>
    export type CreateFireDepartmentAccessMutationBody = CreateFireDepartmentAccessRequest
    export type CreateFireDepartmentAccessMutationError = string

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

      const mutationOptions = getCreateFireDepartmentAccessMutationOptions(options);

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

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

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

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

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

  

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

      

      

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

export type GetFireDepartmentAccessQueryResult = NonNullable<Awaited<ReturnType<typeof getFireDepartmentAccess>>>
export type GetFireDepartmentAccessQueryError = string


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

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

  const queryOptions = getGetFireDepartmentAccessQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const updateFireDepartmentAccess = (
    id: string,
    updateFireDepartmentAccessRequest: UpdateFireDepartmentAccessRequest,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/fire-department-accesses/${id}`, method: 'PUT',
      headers: {'Content-Type': 'application/json', },
      data: updateFireDepartmentAccessRequest
    },
      );
    }
  


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

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

          return  updateFireDepartmentAccess(id,data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateFireDepartmentAccessMutationResult = NonNullable<Awaited<ReturnType<typeof updateFireDepartmentAccess>>>
    export type UpdateFireDepartmentAccessMutationBody = UpdateFireDepartmentAccessRequest
    export type UpdateFireDepartmentAccessMutationError = string

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

      const mutationOptions = getUpdateFireDepartmentAccessMutationOptions(options);

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


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

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

          return  deleteFireDepartmentAccess(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteFireDepartmentAccessMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFireDepartmentAccess>>>
    
    export type DeleteFireDepartmentAccessMutationError = string

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

      const mutationOptions = getDeleteFireDepartmentAccessMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    