/**
 * 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 {
  CreateServiceOrganizationRequest,
  GetApiServiceOrganizationsParams,
  ServiceOrganizationModel,
  UpdateServiceOrganizationRequest
} from './client.schemas';

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





export const getApiServiceOrganizations = (
    params?: GetApiServiceOrganizationsParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<ServiceOrganizationModel[]>(
      {url: `/api/service-organizations`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetApiServiceOrganizationsQueryKey = (params?: GetApiServiceOrganizationsParams,) => {
    return [`/api/service-organizations`, ...(params ? [params]: [])] as const;
    }

    
export const getGetApiServiceOrganizationsQueryOptions = <TData = Awaited<ReturnType<typeof getApiServiceOrganizations>>, TError = unknown>(params?: GetApiServiceOrganizationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiServiceOrganizations>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetApiServiceOrganizationsQueryResult = NonNullable<Awaited<ReturnType<typeof getApiServiceOrganizations>>>
export type GetApiServiceOrganizationsQueryError = unknown


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

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

  const queryOptions = getGetApiServiceOrganizationsQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const postApiServiceOrganizations = (
    createServiceOrganizationRequest: CreateServiceOrganizationRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<void>(
      {url: `/api/service-organizations`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createServiceOrganizationRequest, signal
    },
      );
    }
  


export const getPostApiServiceOrganizationsMutationOptions = <TError = unknown,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postApiServiceOrganizations>>, TError,{data: CreateServiceOrganizationRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof postApiServiceOrganizations>>, TError,{data: CreateServiceOrganizationRequest}, TContext> => {

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

          return  postApiServiceOrganizations(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostApiServiceOrganizationsMutationResult = NonNullable<Awaited<ReturnType<typeof postApiServiceOrganizations>>>
    export type PostApiServiceOrganizationsMutationBody = CreateServiceOrganizationRequest
    export type PostApiServiceOrganizationsMutationError = unknown

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

      const mutationOptions = getPostApiServiceOrganizationsMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const getApiServiceOrganizationsId = (
    id: string,
 signal?: AbortSignal
) => {
      
      
      return customClient<ServiceOrganizationModel>(
      {url: `/api/service-organizations/${id}`, method: 'GET', signal
    },
      );
    }
  

export const getGetApiServiceOrganizationsIdQueryKey = (id: string,) => {
    return [`/api/service-organizations/${id}`] as const;
    }

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

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

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

  

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

      

      

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

export type GetApiServiceOrganizationsIdQueryResult = NonNullable<Awaited<ReturnType<typeof getApiServiceOrganizationsId>>>
export type GetApiServiceOrganizationsIdQueryError = unknown


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

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

  const queryOptions = getGetApiServiceOrganizationsIdQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const putApiServiceOrganizationsId = (
    id: string,
    updateServiceOrganizationRequest: UpdateServiceOrganizationRequest,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/service-organizations/${id}`, method: 'PUT',
      headers: {'Content-Type': 'application/json', },
      data: updateServiceOrganizationRequest
    },
      );
    }
  


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

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

          return  putApiServiceOrganizationsId(id,data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutApiServiceOrganizationsIdMutationResult = NonNullable<Awaited<ReturnType<typeof putApiServiceOrganizationsId>>>
    export type PutApiServiceOrganizationsIdMutationBody = UpdateServiceOrganizationRequest
    export type PutApiServiceOrganizationsIdMutationError = unknown

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

      const mutationOptions = getPutApiServiceOrganizationsIdMutationOptions(options);

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


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

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

          return  deleteApiServiceOrganizationsId(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteApiServiceOrganizationsIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteApiServiceOrganizationsId>>>
    
    export type DeleteApiServiceOrganizationsIdMutationError = unknown

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

      const mutationOptions = getDeleteApiServiceOrganizationsIdMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    