/**
 * Generated by orval v8.9.1 🍺
 * Do not edit manually.
 * Api
 * EHSAN Closed Donation Loop API
 * OpenAPI spec version: 0.1.0
 */
import {
  useMutation,
  useQuery
} from '@tanstack/react-query';
import type {
  MutationFunction,
  QueryFunction,
  QueryKey,
  UseMutationOptions,
  UseMutationResult,
  UseQueryOptions,
  UseQueryResult
} from '@tanstack/react-query';

import type {
  DonationInput,
  DonationRequest,
  DonationRequestInput,
  Donor,
  HealthStatus,
  ListRequestsParams,
  RejectInput,
  Stats,
  ThankYouInput,
  WhatsappLogEntry,
  WhatsappResult
} from './api.schemas';

import { customFetch } from '../custom-fetch';
import type { ErrorType , BodyType } from '../custom-fetch';

type AwaitedInput<T> = PromiseLike<T> | T;

      type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;


type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];



export const getHealthCheckUrl = () => {




  return `/api/healthz`
}

/**
 * @summary Health check
 */
export const healthCheck = async ( options?: RequestInit): Promise<HealthStatus> => {

  return customFetch<HealthStatus>(getHealthCheckUrl(),
  {
    ...options,
    method: 'GET'


  }
);}





export const getHealthCheckQueryKey = () => {
    return [
    `/api/healthz`
    ] as const;
    }


export const getHealthCheckQueryOptions = <TData = Awaited<ReturnType<typeof healthCheck>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof healthCheck>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getHealthCheckQueryKey();



    const queryFn: QueryFunction<Awaited<ReturnType<typeof healthCheck>>> = ({ signal }) => healthCheck({ signal, ...requestOptions });





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

export type HealthCheckQueryResult = NonNullable<Awaited<ReturnType<typeof healthCheck>>>
export type HealthCheckQueryError = ErrorType<unknown>


/**
 * @summary Health check
 */

export function useHealthCheck<TData = Awaited<ReturnType<typeof healthCheck>>, TError = ErrorType<unknown>>(
  options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof healthCheck>>, TError, TData>, request?: SecondParameter<typeof customFetch>}

 ):  UseQueryResult<TData, TError> & { queryKey: QueryKey } {

  const queryOptions = getHealthCheckQueryOptions(options)

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

  return { ...query, queryKey: queryOptions.queryKey };
}







export const getListRequestsUrl = (params?: ListRequestsParams,) => {
  const normalizedParams = new URLSearchParams();

  Object.entries(params || {}).forEach(([key, value]) => {

    if (value !== undefined) {
      normalizedParams.append(key, value === null ? 'null' : value.toString())
    }
  });

  const stringifiedParams = normalizedParams.toString();

  return stringifiedParams.length > 0 ? `/api/requests?${stringifiedParams}` : `/api/requests`
}

/**
 * @summary List all donation requests
 */
export const listRequests = async (params?: ListRequestsParams, options?: RequestInit): Promise<DonationRequest[]> => {

  return customFetch<DonationRequest[]>(getListRequestsUrl(params),
  {
    ...options,
    method: 'GET'


  }
);}





export const getListRequestsQueryKey = (params?: ListRequestsParams,) => {
    return [
    `/api/requests`, ...(params ? [params] : [])
    ] as const;
    }


export const getListRequestsQueryOptions = <TData = Awaited<ReturnType<typeof listRequests>>, TError = ErrorType<unknown>>(params?: ListRequestsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listRequests>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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



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





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

export type ListRequestsQueryResult = NonNullable<Awaited<ReturnType<typeof listRequests>>>
export type ListRequestsQueryError = ErrorType<unknown>


/**
 * @summary List all donation requests
 */

export function useListRequests<TData = Awaited<ReturnType<typeof listRequests>>, TError = ErrorType<unknown>>(
 params?: ListRequestsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listRequests>>, TError, TData>, request?: SecondParameter<typeof customFetch>}

 ):  UseQueryResult<TData, TError> & { queryKey: QueryKey } {

  const queryOptions = getListRequestsQueryOptions(params,options)

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

  return { ...query, queryKey: queryOptions.queryKey };
}







export const getCreateRequestUrl = () => {




  return `/api/requests`
}

/**
 * @summary Submit a new beneficiary request
 */
export const createRequest = async (donationRequestInput: DonationRequestInput, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getCreateRequestUrl(),
  {
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      donationRequestInput,)
  }
);}




export const getCreateRequestMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createRequest>>, TError,{data: BodyType<DonationRequestInput>}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof createRequest>>, TError,{data: BodyType<DonationRequestInput>}, TContext> => {

const mutationKey = ['createRequest'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof createRequest>>, {data: BodyType<DonationRequestInput>}> = (props) => {
          const {data} = props ?? {};

          return  createRequest(data,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type CreateRequestMutationResult = NonNullable<Awaited<ReturnType<typeof createRequest>>>
    export type CreateRequestMutationBody = BodyType<DonationRequestInput>
    export type CreateRequestMutationError = ErrorType<unknown>

    /**
 * @summary Submit a new beneficiary request
 */
export const useCreateRequest = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createRequest>>, TError,{data: BodyType<DonationRequestInput>}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof createRequest>>,
        TError,
        {data: BodyType<DonationRequestInput>},
        TContext
      > => {
      return useMutation(getCreateRequestMutationOptions(options));
    }

export const getListNewRequestsUrl = () => {




  return `/api/requests/new`
}

/**
 * @summary List new (unreviewed) requests
 */
export const listNewRequests = async ( options?: RequestInit): Promise<DonationRequest[]> => {

  return customFetch<DonationRequest[]>(getListNewRequestsUrl(),
  {
    ...options,
    method: 'GET'


  }
);}





export const getListNewRequestsQueryKey = () => {
    return [
    `/api/requests/new`
    ] as const;
    }


export const getListNewRequestsQueryOptions = <TData = Awaited<ReturnType<typeof listNewRequests>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listNewRequests>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getListNewRequestsQueryKey();



    const queryFn: QueryFunction<Awaited<ReturnType<typeof listNewRequests>>> = ({ signal }) => listNewRequests({ signal, ...requestOptions });





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

export type ListNewRequestsQueryResult = NonNullable<Awaited<ReturnType<typeof listNewRequests>>>
export type ListNewRequestsQueryError = ErrorType<unknown>


/**
 * @summary List new (unreviewed) requests
 */

export function useListNewRequests<TData = Awaited<ReturnType<typeof listNewRequests>>, TError = ErrorType<unknown>>(
  options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listNewRequests>>, TError, TData>, request?: SecondParameter<typeof customFetch>}

 ):  UseQueryResult<TData, TError> & { queryKey: QueryKey } {

  const queryOptions = getListNewRequestsQueryOptions(options)

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

  return { ...query, queryKey: queryOptions.queryKey };
}







export const getListPublishedRequestsUrl = () => {




  return `/api/requests/published`
}

/**
 * @summary List published donation opportunities (public)
 */
export const listPublishedRequests = async ( options?: RequestInit): Promise<DonationRequest[]> => {

  return customFetch<DonationRequest[]>(getListPublishedRequestsUrl(),
  {
    ...options,
    method: 'GET'


  }
);}





export const getListPublishedRequestsQueryKey = () => {
    return [
    `/api/requests/published`
    ] as const;
    }


export const getListPublishedRequestsQueryOptions = <TData = Awaited<ReturnType<typeof listPublishedRequests>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listPublishedRequests>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getListPublishedRequestsQueryKey();



    const queryFn: QueryFunction<Awaited<ReturnType<typeof listPublishedRequests>>> = ({ signal }) => listPublishedRequests({ signal, ...requestOptions });





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

export type ListPublishedRequestsQueryResult = NonNullable<Awaited<ReturnType<typeof listPublishedRequests>>>
export type ListPublishedRequestsQueryError = ErrorType<unknown>


/**
 * @summary List published donation opportunities (public)
 */

export function useListPublishedRequests<TData = Awaited<ReturnType<typeof listPublishedRequests>>, TError = ErrorType<unknown>>(
  options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listPublishedRequests>>, TError, TData>, request?: SecondParameter<typeof customFetch>}

 ):  UseQueryResult<TData, TError> & { queryKey: QueryKey } {

  const queryOptions = getListPublishedRequestsQueryOptions(options)

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

  return { ...query, queryKey: queryOptions.queryKey };
}







export const getGetRequestUrl = (id: string,) => {




  return `/api/requests/${id}`
}

/**
 * @summary Get a single request by ID
 */
export const getRequest = async (id: string, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getGetRequestUrl(id),
  {
    ...options,
    method: 'GET'


  }
);}





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


export const getGetRequestQueryOptions = <TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<void>>(id: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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



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





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

export type GetRequestQueryResult = NonNullable<Awaited<ReturnType<typeof getRequest>>>
export type GetRequestQueryError = ErrorType<void>


/**
 * @summary Get a single request by ID
 */

export function useGetRequest<TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<void>>(
 id: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>, request?: SecondParameter<typeof customFetch>}

 ):  UseQueryResult<TData, TError> & { queryKey: QueryKey } {

  const queryOptions = getGetRequestQueryOptions(id,options)

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

  return { ...query, queryKey: queryOptions.queryKey };
}







export const getVerifyRequestUrl = (id: string,) => {




  return `/api/requests/${id}/verify`
}

/**
 * @summary Verify a request (admin)
 */
export const verifyRequest = async (id: string, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getVerifyRequestUrl(id),
  {
    ...options,
    method: 'POST'


  }
);}




export const getVerifyRequestMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof verifyRequest>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof verifyRequest>>, TError,{id: string}, TContext> => {

const mutationKey = ['verifyRequest'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof verifyRequest>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  verifyRequest(id,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type VerifyRequestMutationResult = NonNullable<Awaited<ReturnType<typeof verifyRequest>>>

    export type VerifyRequestMutationError = ErrorType<unknown>

    /**
 * @summary Verify a request (admin)
 */
export const useVerifyRequest = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof verifyRequest>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof verifyRequest>>,
        TError,
        {id: string},
        TContext
      > => {
      return useMutation(getVerifyRequestMutationOptions(options));
    }

export const getPublishRequestUrl = (id: string,) => {




  return `/api/requests/${id}/publish`
}

/**
 * @summary Publish a verified request as a donation opportunity
 */
export const publishRequest = async (id: string, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getPublishRequestUrl(id),
  {
    ...options,
    method: 'POST'


  }
);}




export const getPublishRequestMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof publishRequest>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof publishRequest>>, TError,{id: string}, TContext> => {

const mutationKey = ['publishRequest'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof publishRequest>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  publishRequest(id,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type PublishRequestMutationResult = NonNullable<Awaited<ReturnType<typeof publishRequest>>>

    export type PublishRequestMutationError = ErrorType<unknown>

    /**
 * @summary Publish a verified request as a donation opportunity
 */
export const usePublishRequest = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof publishRequest>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof publishRequest>>,
        TError,
        {id: string},
        TContext
      > => {
      return useMutation(getPublishRequestMutationOptions(options));
    }

export const getDonateToRequestUrl = (id: string,) => {




  return `/api/requests/${id}/donate`
}

/**
 * @summary Simulate a donation to a published request
 */
export const donateToRequest = async (id: string,
    donationInput: DonationInput, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getDonateToRequestUrl(id),
  {
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      donationInput,)
  }
);}




export const getDonateToRequestMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof donateToRequest>>, TError,{id: string;data: BodyType<DonationInput>}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof donateToRequest>>, TError,{id: string;data: BodyType<DonationInput>}, TContext> => {

const mutationKey = ['donateToRequest'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof donateToRequest>>, {id: string;data: BodyType<DonationInput>}> = (props) => {
          const {id,data} = props ?? {};

          return  donateToRequest(id,data,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type DonateToRequestMutationResult = NonNullable<Awaited<ReturnType<typeof donateToRequest>>>
    export type DonateToRequestMutationBody = BodyType<DonationInput>
    export type DonateToRequestMutationError = ErrorType<unknown>

    /**
 * @summary Simulate a donation to a published request
 */
export const useDonateToRequest = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof donateToRequest>>, TError,{id: string;data: BodyType<DonationInput>}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof donateToRequest>>,
        TError,
        {id: string;data: BodyType<DonationInput>},
        TContext
      > => {
      return useMutation(getDonateToRequestMutationOptions(options));
    }

export const getDeliverSupportUrl = (id: string,) => {




  return `/api/requests/${id}/deliver`
}

/**
 * @summary Mark support as delivered
 */
export const deliverSupport = async (id: string, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getDeliverSupportUrl(id),
  {
    ...options,
    method: 'POST'


  }
);}




export const getDeliverSupportMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deliverSupport>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof deliverSupport>>, TError,{id: string}, TContext> => {

const mutationKey = ['deliverSupport'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof deliverSupport>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  deliverSupport(id,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type DeliverSupportMutationResult = NonNullable<Awaited<ReturnType<typeof deliverSupport>>>

    export type DeliverSupportMutationError = ErrorType<unknown>

    /**
 * @summary Mark support as delivered
 */
export const useDeliverSupport = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deliverSupport>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof deliverSupport>>,
        TError,
        {id: string},
        TContext
      > => {
      return useMutation(getDeliverSupportMutationOptions(options));
    }

export const getConfirmReceiptUrl = (id: string,) => {




  return `/api/requests/${id}/confirm-receipt`
}

/**
 * @summary Confirm beneficiary received support
 */
export const confirmReceipt = async (id: string, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getConfirmReceiptUrl(id),
  {
    ...options,
    method: 'POST'


  }
);}




export const getConfirmReceiptMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof confirmReceipt>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof confirmReceipt>>, TError,{id: string}, TContext> => {

const mutationKey = ['confirmReceipt'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof confirmReceipt>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  confirmReceipt(id,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type ConfirmReceiptMutationResult = NonNullable<Awaited<ReturnType<typeof confirmReceipt>>>

    export type ConfirmReceiptMutationError = ErrorType<unknown>

    /**
 * @summary Confirm beneficiary received support
 */
export const useConfirmReceipt = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof confirmReceipt>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof confirmReceipt>>,
        TError,
        {id: string},
        TContext
      > => {
      return useMutation(getConfirmReceiptMutationOptions(options));
    }

export const getSubmitThankYouUrl = (id: string,) => {




  return `/api/requests/${id}/thank-you`
}

/**
 * @summary Submit beneficiary thank-you message
 */
export const submitThankYou = async (id: string,
    thankYouInput: ThankYouInput, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getSubmitThankYouUrl(id),
  {
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      thankYouInput,)
  }
);}




export const getSubmitThankYouMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitThankYou>>, TError,{id: string;data: BodyType<ThankYouInput>}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof submitThankYou>>, TError,{id: string;data: BodyType<ThankYouInput>}, TContext> => {

const mutationKey = ['submitThankYou'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof submitThankYou>>, {id: string;data: BodyType<ThankYouInput>}> = (props) => {
          const {id,data} = props ?? {};

          return  submitThankYou(id,data,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type SubmitThankYouMutationResult = NonNullable<Awaited<ReturnType<typeof submitThankYou>>>
    export type SubmitThankYouMutationBody = BodyType<ThankYouInput>
    export type SubmitThankYouMutationError = ErrorType<unknown>

    /**
 * @summary Submit beneficiary thank-you message
 */
export const useSubmitThankYou = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitThankYou>>, TError,{id: string;data: BodyType<ThankYouInput>}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof submitThankYou>>,
        TError,
        {id: string;data: BodyType<ThankYouInput>},
        TContext
      > => {
      return useMutation(getSubmitThankYouMutationOptions(options));
    }

export const getSendWhatsappUrl = (id: string,) => {




  return `/api/requests/${id}/send-whatsapp`
}

/**
 * @summary Send thank-you WhatsApp to donor via OpenClaw
 */
export const sendWhatsapp = async (id: string, options?: RequestInit): Promise<WhatsappResult> => {

  return customFetch<WhatsappResult>(getSendWhatsappUrl(id),
  {
    ...options,
    method: 'POST'


  }
);}




export const getSendWhatsappMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendWhatsapp>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof sendWhatsapp>>, TError,{id: string}, TContext> => {

const mutationKey = ['sendWhatsapp'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof sendWhatsapp>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  sendWhatsapp(id,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type SendWhatsappMutationResult = NonNullable<Awaited<ReturnType<typeof sendWhatsapp>>>

    export type SendWhatsappMutationError = ErrorType<unknown>

    /**
 * @summary Send thank-you WhatsApp to donor via OpenClaw
 */
export const useSendWhatsapp = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendWhatsapp>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof sendWhatsapp>>,
        TError,
        {id: string},
        TContext
      > => {
      return useMutation(getSendWhatsappMutationOptions(options));
    }

export const getCloseRequestUrl = (id: string,) => {




  return `/api/requests/${id}/close`
}

/**
 * @summary Close the case
 */
export const closeRequest = async (id: string, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getCloseRequestUrl(id),
  {
    ...options,
    method: 'POST'


  }
);}




export const getCloseRequestMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeRequest>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof closeRequest>>, TError,{id: string}, TContext> => {

const mutationKey = ['closeRequest'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof closeRequest>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  closeRequest(id,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type CloseRequestMutationResult = NonNullable<Awaited<ReturnType<typeof closeRequest>>>

    export type CloseRequestMutationError = ErrorType<unknown>

    /**
 * @summary Close the case
 */
export const useCloseRequest = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeRequest>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof closeRequest>>,
        TError,
        {id: string},
        TContext
      > => {
      return useMutation(getCloseRequestMutationOptions(options));
    }

export const getRejectRequestUrl = (id: string,) => {




  return `/api/requests/${id}/reject`
}

/**
 * @summary Reject a request
 */
export const rejectRequest = async (id: string,
    rejectInput?: RejectInput, options?: RequestInit): Promise<DonationRequest> => {

  return customFetch<DonationRequest>(getRejectRequestUrl(id),
  {
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      rejectInput,)
  }
);}




export const getRejectRequestMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof rejectRequest>>, TError,{id: string;data?: BodyType<RejectInput>}, TContext>, request?: SecondParameter<typeof customFetch>}
): UseMutationOptions<Awaited<ReturnType<typeof rejectRequest>>, TError,{id: string;data?: BodyType<RejectInput>}, TContext> => {

const mutationKey = ['rejectRequest'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};




      const mutationFn: MutationFunction<Awaited<ReturnType<typeof rejectRequest>>, {id: string;data?: BodyType<RejectInput>}> = (props) => {
          const {id,data} = props ?? {};

          return  rejectRequest(id,data,requestOptions)
        }






  return  { mutationFn, ...mutationOptions }}

    export type RejectRequestMutationResult = NonNullable<Awaited<ReturnType<typeof rejectRequest>>>
    export type RejectRequestMutationBody = BodyType<RejectInput> | undefined
    export type RejectRequestMutationError = ErrorType<unknown>

    /**
 * @summary Reject a request
 */
export const useRejectRequest = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof rejectRequest>>, TError,{id: string;data?: BodyType<RejectInput>}, TContext>, request?: SecondParameter<typeof customFetch>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof rejectRequest>>,
        TError,
        {id: string;data?: BodyType<RejectInput>},
        TContext
      > => {
      return useMutation(getRejectRequestMutationOptions(options));
    }

export const getListDonorsUrl = () => {




  return `/api/donors`
}

/**
 * @summary List all donors
 */
export const listDonors = async ( options?: RequestInit): Promise<Donor[]> => {

  return customFetch<Donor[]>(getListDonorsUrl(),
  {
    ...options,
    method: 'GET'


  }
);}





export const getListDonorsQueryKey = () => {
    return [
    `/api/donors`
    ] as const;
    }


export const getListDonorsQueryOptions = <TData = Awaited<ReturnType<typeof listDonors>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listDonors>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getListDonorsQueryKey();



    const queryFn: QueryFunction<Awaited<ReturnType<typeof listDonors>>> = ({ signal }) => listDonors({ signal, ...requestOptions });





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

export type ListDonorsQueryResult = NonNullable<Awaited<ReturnType<typeof listDonors>>>
export type ListDonorsQueryError = ErrorType<unknown>


/**
 * @summary List all donors
 */

export function useListDonors<TData = Awaited<ReturnType<typeof listDonors>>, TError = ErrorType<unknown>>(
  options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listDonors>>, TError, TData>, request?: SecondParameter<typeof customFetch>}

 ):  UseQueryResult<TData, TError> & { queryKey: QueryKey } {

  const queryOptions = getListDonorsQueryOptions(options)

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

  return { ...query, queryKey: queryOptions.queryKey };
}







export const getGetStatsUrl = () => {




  return `/api/stats`
}

/**
 * @summary Dashboard statistics summary
 */
export const getStats = async ( options?: RequestInit): Promise<Stats> => {

  return customFetch<Stats>(getGetStatsUrl(),
  {
    ...options,
    method: 'GET'


  }
);}





export const getGetStatsQueryKey = () => {
    return [
    `/api/stats`
    ] as const;
    }


export const getGetStatsQueryOptions = <TData = Awaited<ReturnType<typeof getStats>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getStats>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getGetStatsQueryKey();



    const queryFn: QueryFunction<Awaited<ReturnType<typeof getStats>>> = ({ signal }) => getStats({ signal, ...requestOptions });





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

export type GetStatsQueryResult = NonNullable<Awaited<ReturnType<typeof getStats>>>
export type GetStatsQueryError = ErrorType<unknown>


/**
 * @summary Dashboard statistics summary
 */

export function useGetStats<TData = Awaited<ReturnType<typeof getStats>>, TError = ErrorType<unknown>>(
  options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getStats>>, TError, TData>, request?: SecondParameter<typeof customFetch>}

 ):  UseQueryResult<TData, TError> & { queryKey: QueryKey } {

  const queryOptions = getGetStatsQueryOptions(options)

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

  return { ...query, queryKey: queryOptions.queryKey };
}







export const getListWhatsappLogUrl = () => {




  return `/api/whatsapp-log`
}

/**
 * @summary List all WhatsApp message log entries
 */
export const listWhatsappLog = async ( options?: RequestInit): Promise<WhatsappLogEntry[]> => {

  return customFetch<WhatsappLogEntry[]>(getListWhatsappLogUrl(),
  {
    ...options,
    method: 'GET'


  }
);}





export const getListWhatsappLogQueryKey = () => {
    return [
    `/api/whatsapp-log`
    ] as const;
    }


export const getListWhatsappLogQueryOptions = <TData = Awaited<ReturnType<typeof listWhatsappLog>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listWhatsappLog>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getListWhatsappLogQueryKey();



    const queryFn: QueryFunction<Awaited<ReturnType<typeof listWhatsappLog>>> = ({ signal }) => listWhatsappLog({ signal, ...requestOptions });





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

export type ListWhatsappLogQueryResult = NonNullable<Awaited<ReturnType<typeof listWhatsappLog>>>
export type ListWhatsappLogQueryError = ErrorType<unknown>


/**
 * @summary List all WhatsApp message log entries
 */

export function useListWhatsappLog<TData = Awaited<ReturnType<typeof listWhatsappLog>>, TError = ErrorType<unknown>>(
  options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listWhatsappLog>>, TError, TData>, request?: SecondParameter<typeof customFetch>}

 ):  UseQueryResult<TData, TError> & { queryKey: QueryKey } {

  const queryOptions = getListWhatsappLogQueryOptions(options)

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

  return { ...query, queryKey: queryOptions.queryKey };
}







