/**
 * 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 {
  CreateReportRequest,
  CreateReportResponse,
  GetReportListParams,
  GetReportResponse,
  TableDataResponseModelOfGetReportsResponseItem
} from './client.schemas';

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





export const getReportList = (
    params?: GetReportListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfGetReportsResponseItem>(
      {url: `/api/reports`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetReportListQueryKey = (params?: GetReportListParams,) => {
    return [`/api/reports`, ...(params ? [params]: [])] as const;
    }

    
export const getGetReportListQueryOptions = <TData = Awaited<ReturnType<typeof getReportList>>, TError = string>(params?: GetReportListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getReportList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetReportListQueryResult = NonNullable<Awaited<ReturnType<typeof getReportList>>>
export type GetReportListQueryError = string


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

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

  const queryOptions = getGetReportListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createReport = (
    createReportRequest: CreateReportRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<CreateReportResponse>(
      {url: `/api/reports`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createReportRequest, signal
    },
      );
    }
  


export const getCreateReportMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createReport>>, TError,{data: CreateReportRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createReport>>, TError,{data: CreateReportRequest}, TContext> => {

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

          return  createReport(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateReportMutationResult = NonNullable<Awaited<ReturnType<typeof createReport>>>
    export type CreateReportMutationBody = CreateReportRequest
    export type CreateReportMutationError = string

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

      const mutationOptions = getCreateReportMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const deleteAllReports = (
    
 ) => {
      
      
      return customClient<void>(
      {url: `/api/reports`, method: 'DELETE'
    },
      );
    }
  


export const getDeleteAllReportsMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAllReports>>, TError,void, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof deleteAllReports>>, TError,void, TContext> => {

const mutationKey = ['deleteAllReports'];
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 deleteAllReports>>, void> = () => {
          

          return  deleteAllReports()
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteAllReportsMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAllReports>>>
    
    export type DeleteAllReportsMutationError = string

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

      const mutationOptions = getDeleteAllReportsMutationOptions(options);

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

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

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

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

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

  

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

      

      

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

export type GetReportQueryResult = NonNullable<Awaited<ReturnType<typeof getReport>>>
export type GetReportQueryError = string


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

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

  const queryOptions = getGetReportQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const deleteReport = (
    id: string,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/reports/${id}`, method: 'DELETE'
    },
      );
    }
  


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

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

          return  deleteReport(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteReportMutationResult = NonNullable<Awaited<ReturnType<typeof deleteReport>>>
    
    export type DeleteReportMutationError = string

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

      const mutationOptions = getDeleteReportMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    