/**
 * Generated by orval v8.8.0 🍺
 * Do not edit manually.
 * OpenAPI spec version: 0.0.0
 */
import { useQuery } from "@tanstack/react-query";
import type {
  DataTag,
  DefinedInitialDataOptions,
  DefinedUseQueryResult,
  QueryClient,
  QueryFunction,
  QueryKey,
  UndefinedInitialDataOptions,
  UseQueryOptions,
  UseQueryResult,
} from "@tanstack/react-query";

import { privateMutator } from "../../../privateClient";

/**
 * @summary Get Trading212 account cash
 */
export const apiTrading212EquityCashRetrieve = (signal?: AbortSignal) => {
  return privateMutator<void>({
    url: `/api/trading212/equity/cash/`,
    method: "GET",
    signal,
  });
};

export const getApiTrading212EquityCashRetrieveQueryKey = () => {
  return [`/api/trading212/equity/cash/`] as const;
};

export const getApiTrading212EquityCashRetrieveQueryOptions = <
  TData = Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
  TError = unknown,
>(options?: {
  query?: Partial<
    UseQueryOptions<
      Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
      TError,
      TData
    >
  >;
}) => {
  const { query: queryOptions } = options ?? {};

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

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

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

export type ApiTrading212EquityCashRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
>;
export type ApiTrading212EquityCashRetrieveQueryError = unknown;

export function useApiTrading212EquityCashRetrieve<
  TData = Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiTrading212EquityCashRetrieve<
  TData = Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiTrading212EquityCashRetrieve<
  TData = Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get Trading212 account cash
 */

export function useApiTrading212EquityCashRetrieve<
  TData = Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getApiTrading212EquityCashRetrieveQueryOptions(options);

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

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

/**
 * @summary Get Trading212 account summary
 */
export const apiTrading212EquitySummaryRetrieve = (signal?: AbortSignal) => {
  return privateMutator<void>({
    url: `/api/trading212/equity/summary/`,
    method: "GET",
    signal,
  });
};

export const getApiTrading212EquitySummaryRetrieveQueryKey = () => {
  return [`/api/trading212/equity/summary/`] as const;
};

export const getApiTrading212EquitySummaryRetrieveQueryOptions = <
  TData = Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
  TError = unknown,
>(options?: {
  query?: Partial<
    UseQueryOptions<
      Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
      TError,
      TData
    >
  >;
}) => {
  const { query: queryOptions } = options ?? {};

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

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

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

export type ApiTrading212EquitySummaryRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
>;
export type ApiTrading212EquitySummaryRetrieveQueryError = unknown;

export function useApiTrading212EquitySummaryRetrieve<
  TData = Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiTrading212EquitySummaryRetrieve<
  TData = Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiTrading212EquitySummaryRetrieve<
  TData = Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get Trading212 account summary
 */

export function useApiTrading212EquitySummaryRetrieve<
  TData = Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions =
    getApiTrading212EquitySummaryRetrieveQueryOptions(options);

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

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