/**
 * 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 {
  CreateZoneRequest,
  GetZoneListParams,
  TableDataResponseModelOfZoneModel,
  UpdateZoneRequest,
  ZoneModel
} from './client.schemas';

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





export const getZoneList = (
    params?: GetZoneListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfZoneModel>(
      {url: `/api/zones`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetZoneListQueryKey = (params?: GetZoneListParams,) => {
    return [`/api/zones`, ...(params ? [params]: [])] as const;
    }

    
export const getGetZoneListQueryOptions = <TData = Awaited<ReturnType<typeof getZoneList>>, TError = unknown>(params?: GetZoneListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getZoneList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetZoneListQueryResult = NonNullable<Awaited<ReturnType<typeof getZoneList>>>
export type GetZoneListQueryError = unknown


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

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

  const queryOptions = getGetZoneListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createZone = (
    createZoneRequest: CreateZoneRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<ZoneModel>(
      {url: `/api/zones`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createZoneRequest, signal
    },
      );
    }
  


export const getCreateZoneMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createZone>>, TError,{data: CreateZoneRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createZone>>, TError,{data: CreateZoneRequest}, TContext> => {

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

          return  createZone(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateZoneMutationResult = NonNullable<Awaited<ReturnType<typeof createZone>>>
    export type CreateZoneMutationBody = CreateZoneRequest
    export type CreateZoneMutationError = string

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

      const mutationOptions = getCreateZoneMutationOptions(options);

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

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

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

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

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

  

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

      

      

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

export type GetZoneQueryResult = NonNullable<Awaited<ReturnType<typeof getZone>>>
export type GetZoneQueryError = string


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

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

  const queryOptions = getGetZoneQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



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


export const getUpdateZoneMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateZone>>, TError,{id: string;data: UpdateZoneRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof updateZone>>, TError,{id: string;data: UpdateZoneRequest}, TContext> => {

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

          return  updateZone(id,data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateZoneMutationResult = NonNullable<Awaited<ReturnType<typeof updateZone>>>
    export type UpdateZoneMutationBody = UpdateZoneRequest
    export type UpdateZoneMutationError = string

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

      const mutationOptions = getUpdateZoneMutationOptions(options);

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


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

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

          return  deleteZone(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteZoneMutationResult = NonNullable<Awaited<ReturnType<typeof deleteZone>>>
    
    export type DeleteZoneMutationError = string

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

      const mutationOptions = getDeleteZoneMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    