/**
 * 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 {
  CreateOrganizationRequest,
  GetOrganizationListParams,
  OrganizationModel,
  ProblemDetails,
  TableDataResponseModelOfOrganizationModel,
  UpdateOrganizationRequest
} from './client.schemas';

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





export const getOrganizationList = (
    params?: GetOrganizationListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfOrganizationModel>(
      {url: `/api/Organizations`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetOrganizationListQueryKey = (params?: GetOrganizationListParams,) => {
    return [`/api/Organizations`, ...(params ? [params]: [])] as const;
    }

    
export const getGetOrganizationListQueryOptions = <TData = Awaited<ReturnType<typeof getOrganizationList>>, TError = unknown>(params?: GetOrganizationListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganizationList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetOrganizationListQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganizationList>>>
export type GetOrganizationListQueryError = unknown


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

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

  const queryOptions = getGetOrganizationListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createOrganization = (
    createOrganizationRequest: CreateOrganizationRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<OrganizationModel>(
      {url: `/api/Organizations`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createOrganizationRequest, signal
    },
      );
    }
  


export const getCreateOrganizationMutationOptions = <TError = ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganization>>, TError,{data: CreateOrganizationRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createOrganization>>, TError,{data: CreateOrganizationRequest}, TContext> => {

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

          return  createOrganization(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateOrganizationMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganization>>>
    export type CreateOrganizationMutationBody = CreateOrganizationRequest
    export type CreateOrganizationMutationError = ProblemDetails

    export const useCreateOrganization = <TError = ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganization>>, TError,{data: CreateOrganizationRequest}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof createOrganization>>,
        TError,
        {data: CreateOrganizationRequest},
        TContext
      > => {

      const mutationOptions = getCreateOrganizationMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const getOrganization = (
    id: string,
 signal?: AbortSignal
) => {
      
      
      return customClient<OrganizationModel>(
      {url: `/api/Organizations/${id}`, method: 'GET', signal
    },
      );
    }
  

export const getGetOrganizationQueryKey = (id: string,) => {
    return [`/api/Organizations/${id}`] as const;
    }

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

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

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

  

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

      

      

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

export type GetOrganizationQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganization>>>
export type GetOrganizationQueryError = ProblemDetails


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

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

  const queryOptions = getGetOrganizationQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const updateOrganization = (
    id: string,
    updateOrganizationRequest: UpdateOrganizationRequest,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/Organizations/${id}`, method: 'PUT',
      headers: {'Content-Type': 'application/json', },
      data: updateOrganizationRequest
    },
      );
    }
  


export const getUpdateOrganizationMutationOptions = <TError = ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateOrganization>>, TError,{id: string;data: UpdateOrganizationRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof updateOrganization>>, TError,{id: string;data: UpdateOrganizationRequest}, TContext> => {

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

          return  updateOrganization(id,data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateOrganizationMutationResult = NonNullable<Awaited<ReturnType<typeof updateOrganization>>>
    export type UpdateOrganizationMutationBody = UpdateOrganizationRequest
    export type UpdateOrganizationMutationError = ProblemDetails

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

      const mutationOptions = getUpdateOrganizationMutationOptions(options);

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


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

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

          return  deleteOrganization(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteOrganizationMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganization>>>
    
    export type DeleteOrganizationMutationError = ProblemDetails

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

      const mutationOptions = getDeleteOrganizationMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    