/**
 * 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 {
  CameraViewModel,
  CreateCameraViewRequest,
  GetCameraViewListParams,
  TableDataResponseModelOfCameraViewModel,
  UpdateCameraViewRequest
} from './client.schemas';

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





export const getCameraViewList = (
    params?: GetCameraViewListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfCameraViewModel>(
      {url: `/api/camera-views`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetCameraViewListQueryKey = (params?: GetCameraViewListParams,) => {
    return [`/api/camera-views`, ...(params ? [params]: [])] as const;
    }

    
export const getGetCameraViewListQueryOptions = <TData = Awaited<ReturnType<typeof getCameraViewList>>, TError = unknown>(params?: GetCameraViewListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCameraViewList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetCameraViewListQueryResult = NonNullable<Awaited<ReturnType<typeof getCameraViewList>>>
export type GetCameraViewListQueryError = unknown


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

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

  const queryOptions = getGetCameraViewListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createCameraView = (
    createCameraViewRequest: CreateCameraViewRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<CameraViewModel>(
      {url: `/api/camera-views`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createCameraViewRequest, signal
    },
      );
    }
  


export const getCreateCameraViewMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createCameraView>>, TError,{data: CreateCameraViewRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createCameraView>>, TError,{data: CreateCameraViewRequest}, TContext> => {

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

          return  createCameraView(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateCameraViewMutationResult = NonNullable<Awaited<ReturnType<typeof createCameraView>>>
    export type CreateCameraViewMutationBody = CreateCameraViewRequest
    export type CreateCameraViewMutationError = string

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

      const mutationOptions = getCreateCameraViewMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const getCameraView = (
    id: string,
 signal?: AbortSignal
) => {
      
      
      return customClient<CameraViewModel>(
      {url: `/api/camera-views/${id}`, method: 'GET', signal
    },
      );
    }
  

export const getGetCameraViewQueryKey = (id: string,) => {
    return [`/api/camera-views/${id}`] as const;
    }

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

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

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

  

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

      

      

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

export type GetCameraViewQueryResult = NonNullable<Awaited<ReturnType<typeof getCameraView>>>
export type GetCameraViewQueryError = string


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

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

  const queryOptions = getGetCameraViewQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const updateCameraView = (
    id: string,
    updateCameraViewRequest: UpdateCameraViewRequest,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/camera-views/${id}`, method: 'PUT',
      headers: {'Content-Type': 'application/json', },
      data: updateCameraViewRequest
    },
      );
    }
  


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

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

          return  updateCameraView(id,data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateCameraViewMutationResult = NonNullable<Awaited<ReturnType<typeof updateCameraView>>>
    export type UpdateCameraViewMutationBody = UpdateCameraViewRequest
    export type UpdateCameraViewMutationError = string

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

      const mutationOptions = getUpdateCameraViewMutationOptions(options);

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


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

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

          return  deleteCameraView(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteCameraViewMutationResult = NonNullable<Awaited<ReturnType<typeof deleteCameraView>>>
    
    export type DeleteCameraViewMutationError = string

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

      const mutationOptions = getDeleteCameraViewMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    