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

import type { HealthStatusResponse } from ".././model";

import { customFetch } from "../../mutator";

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

/**
 * Lightweight liveness probe endpoint.
 * @summary Health Check
 */
export type healthHealthGetResponse200 = {
  data: HealthStatusResponse;
  status: 200;
};

export type healthHealthGetResponseSuccess = healthHealthGetResponse200 & {
  headers: Headers;
};
export type healthHealthGetResponse = healthHealthGetResponseSuccess;

export const getHealthHealthGetUrl = () => {
  return `/health`;
};

export const healthHealthGet = async (
  options?: RequestInit,
): Promise<healthHealthGetResponse> => {
  return customFetch<healthHealthGetResponse>(getHealthHealthGetUrl(), {
    ...options,
    method: "GET",
  });
};

export const getHealthHealthGetQueryKey = () => {
  return [`/health`] as const;
};

export const getHealthHealthGetQueryOptions = <
  TData = Awaited<ReturnType<typeof healthHealthGet>>,
  TError = unknown,
>(options?: {
  query?: Partial<
    UseQueryOptions<Awaited<ReturnType<typeof healthHealthGet>>, TError, TData>
  >;
  request?: SecondParameter<typeof customFetch>;
}) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

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

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

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

export type HealthHealthGetQueryResult = NonNullable<
  Awaited<ReturnType<typeof healthHealthGet>>
>;
export type HealthHealthGetQueryError = unknown;

export function useHealthHealthGet<
  TData = Awaited<ReturnType<typeof healthHealthGet>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof healthHealthGet>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof healthHealthGet>>,
          TError,
          Awaited<ReturnType<typeof healthHealthGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useHealthHealthGet<
  TData = Awaited<ReturnType<typeof healthHealthGet>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof healthHealthGet>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof healthHealthGet>>,
          TError,
          Awaited<ReturnType<typeof healthHealthGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useHealthHealthGet<
  TData = Awaited<ReturnType<typeof healthHealthGet>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof healthHealthGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Health Check
 */

export function useHealthHealthGet<
  TData = Awaited<ReturnType<typeof healthHealthGet>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof healthHealthGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getHealthHealthGetQueryOptions(options);

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

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

/**
 * Alias liveness probe endpoint for platform compatibility.
 * @summary Health Alias Check
 */
export type healthzHealthzGetResponse200 = {
  data: HealthStatusResponse;
  status: 200;
};

export type healthzHealthzGetResponseSuccess = healthzHealthzGetResponse200 & {
  headers: Headers;
};
export type healthzHealthzGetResponse = healthzHealthzGetResponseSuccess;

export const getHealthzHealthzGetUrl = () => {
  return `/healthz`;
};

export const healthzHealthzGet = async (
  options?: RequestInit,
): Promise<healthzHealthzGetResponse> => {
  return customFetch<healthzHealthzGetResponse>(getHealthzHealthzGetUrl(), {
    ...options,
    method: "GET",
  });
};

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

export const getHealthzHealthzGetQueryOptions = <
  TData = Awaited<ReturnType<typeof healthzHealthzGet>>,
  TError = unknown,
>(options?: {
  query?: Partial<
    UseQueryOptions<
      Awaited<ReturnType<typeof healthzHealthzGet>>,
      TError,
      TData
    >
  >;
  request?: SecondParameter<typeof customFetch>;
}) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

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

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

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

export type HealthzHealthzGetQueryResult = NonNullable<
  Awaited<ReturnType<typeof healthzHealthzGet>>
>;
export type HealthzHealthzGetQueryError = unknown;

export function useHealthzHealthzGet<
  TData = Awaited<ReturnType<typeof healthzHealthzGet>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof healthzHealthzGet>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof healthzHealthzGet>>,
          TError,
          Awaited<ReturnType<typeof healthzHealthzGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useHealthzHealthzGet<
  TData = Awaited<ReturnType<typeof healthzHealthzGet>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof healthzHealthzGet>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof healthzHealthzGet>>,
          TError,
          Awaited<ReturnType<typeof healthzHealthzGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useHealthzHealthzGet<
  TData = Awaited<ReturnType<typeof healthzHealthzGet>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof healthzHealthzGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Health Alias Check
 */

export function useHealthzHealthzGet<
  TData = Awaited<ReturnType<typeof healthzHealthzGet>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof healthzHealthzGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getHealthzHealthzGetQueryOptions(options);

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

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

/**
 * Readiness probe endpoint for service orchestration checks.
 * @summary Readiness Check
 */
export type readyzReadyzGetResponse200 = {
  data: HealthStatusResponse;
  status: 200;
};

export type readyzReadyzGetResponseSuccess = readyzReadyzGetResponse200 & {
  headers: Headers;
};
export type readyzReadyzGetResponse = readyzReadyzGetResponseSuccess;

export const getReadyzReadyzGetUrl = () => {
  return `/readyz`;
};

export const readyzReadyzGet = async (
  options?: RequestInit,
): Promise<readyzReadyzGetResponse> => {
  return customFetch<readyzReadyzGetResponse>(getReadyzReadyzGetUrl(), {
    ...options,
    method: "GET",
  });
};

export const getReadyzReadyzGetQueryKey = () => {
  return [`/readyz`] as const;
};

export const getReadyzReadyzGetQueryOptions = <
  TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
  TError = unknown,
>(options?: {
  query?: Partial<
    UseQueryOptions<Awaited<ReturnType<typeof readyzReadyzGet>>, TError, TData>
  >;
  request?: SecondParameter<typeof customFetch>;
}) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

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

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

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

export type ReadyzReadyzGetQueryResult = NonNullable<
  Awaited<ReturnType<typeof readyzReadyzGet>>
>;
export type ReadyzReadyzGetQueryError = unknown;

export function useReadyzReadyzGet<
  TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof readyzReadyzGet>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof readyzReadyzGet>>,
          TError,
          Awaited<ReturnType<typeof readyzReadyzGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useReadyzReadyzGet<
  TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof readyzReadyzGet>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof readyzReadyzGet>>,
          TError,
          Awaited<ReturnType<typeof readyzReadyzGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useReadyzReadyzGet<
  TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof readyzReadyzGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Readiness Check
 */

export function useReadyzReadyzGet<
  TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof readyzReadyzGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getReadyzReadyzGetQueryOptions(options);

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

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