/**
 * Generated by orval v8.3.0 🍺
 * Do not edit manually.
 * Mission Control API
 * OpenAPI spec version: 0.1.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 {
  BoardCreate,
  BoardGroupSnapshot,
  BoardRead,
  BoardSnapshot,
  BoardUpdate,
  GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetParams,
  HTTPValidationError,
  LimitOffsetPageTypeVarCustomizedBoardRead,
  ListBoardsApiV1BoardsGetParams,
  OkResponse,
} from ".././model";

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

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

/**
 * List boards visible to the current organization member.
 * @summary List Boards
 */
export type listBoardsApiV1BoardsGetResponse200 = {
  data: LimitOffsetPageTypeVarCustomizedBoardRead;
  status: 200;
};

export type listBoardsApiV1BoardsGetResponse422 = {
  data: HTTPValidationError;
  status: 422;
};

export type listBoardsApiV1BoardsGetResponseSuccess =
  listBoardsApiV1BoardsGetResponse200 & {
    headers: Headers;
  };
export type listBoardsApiV1BoardsGetResponseError =
  listBoardsApiV1BoardsGetResponse422 & {
    headers: Headers;
  };

export type listBoardsApiV1BoardsGetResponse =
  | listBoardsApiV1BoardsGetResponseSuccess
  | listBoardsApiV1BoardsGetResponseError;

export const getListBoardsApiV1BoardsGetUrl = (
  params?: ListBoardsApiV1BoardsGetParams,
) => {
  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/v1/boards?${stringifiedParams}`
    : `/api/v1/boards`;
};

export const listBoardsApiV1BoardsGet = async (
  params?: ListBoardsApiV1BoardsGetParams,
  options?: RequestInit,
): Promise<listBoardsApiV1BoardsGetResponse> => {
  return customFetch<listBoardsApiV1BoardsGetResponse>(
    getListBoardsApiV1BoardsGetUrl(params),
    {
      ...options,
      method: "GET",
    },
  );
};

export const getListBoardsApiV1BoardsGetQueryKey = (
  params?: ListBoardsApiV1BoardsGetParams,
) => {
  return [`/api/v1/boards`, ...(params ? [params] : [])] as const;
};

export const getListBoardsApiV1BoardsGetQueryOptions = <
  TData = Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
  TError = HTTPValidationError,
>(
  params?: ListBoardsApiV1BoardsGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

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

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

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

export type ListBoardsApiV1BoardsGetQueryResult = NonNullable<
  Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>
>;
export type ListBoardsApiV1BoardsGetQueryError = HTTPValidationError;

export function useListBoardsApiV1BoardsGet<
  TData = Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
  TError = HTTPValidationError,
>(
  params: undefined | ListBoardsApiV1BoardsGetParams,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
          TError,
          Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListBoardsApiV1BoardsGet<
  TData = Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
  TError = HTTPValidationError,
>(
  params?: ListBoardsApiV1BoardsGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
          TError,
          Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListBoardsApiV1BoardsGet<
  TData = Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
  TError = HTTPValidationError,
>(
  params?: ListBoardsApiV1BoardsGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary List Boards
 */

export function useListBoardsApiV1BoardsGet<
  TData = Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
  TError = HTTPValidationError,
>(
  params?: ListBoardsApiV1BoardsGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof listBoardsApiV1BoardsGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getListBoardsApiV1BoardsGetQueryOptions(params, options);

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

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

/**
 * Create a board in the active organization.
 * @summary Create Board
 */
export type createBoardApiV1BoardsPostResponse200 = {
  data: BoardRead;
  status: 200;
};

export type createBoardApiV1BoardsPostResponse422 = {
  data: HTTPValidationError;
  status: 422;
};

export type createBoardApiV1BoardsPostResponseSuccess =
  createBoardApiV1BoardsPostResponse200 & {
    headers: Headers;
  };
export type createBoardApiV1BoardsPostResponseError =
  createBoardApiV1BoardsPostResponse422 & {
    headers: Headers;
  };

export type createBoardApiV1BoardsPostResponse =
  | createBoardApiV1BoardsPostResponseSuccess
  | createBoardApiV1BoardsPostResponseError;

export const getCreateBoardApiV1BoardsPostUrl = () => {
  return `/api/v1/boards`;
};

export const createBoardApiV1BoardsPost = async (
  boardCreate: BoardCreate,
  options?: RequestInit,
): Promise<createBoardApiV1BoardsPostResponse> => {
  return customFetch<createBoardApiV1BoardsPostResponse>(
    getCreateBoardApiV1BoardsPostUrl(),
    {
      ...options,
      method: "POST",
      headers: { "Content-Type": "application/json", ...options?.headers },
      body: JSON.stringify(boardCreate),
    },
  );
};

export const getCreateBoardApiV1BoardsPostMutationOptions = <
  TError = HTTPValidationError,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof createBoardApiV1BoardsPost>>,
    TError,
    { data: BoardCreate },
    TContext
  >;
  request?: SecondParameter<typeof customFetch>;
}): UseMutationOptions<
  Awaited<ReturnType<typeof createBoardApiV1BoardsPost>>,
  TError,
  { data: BoardCreate },
  TContext
> => {
  const mutationKey = ["createBoardApiV1BoardsPost"];
  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 createBoardApiV1BoardsPost>>,
    { data: BoardCreate }
  > = (props) => {
    const { data } = props ?? {};

    return createBoardApiV1BoardsPost(data, requestOptions);
  };

  return { mutationFn, ...mutationOptions };
};

export type CreateBoardApiV1BoardsPostMutationResult = NonNullable<
  Awaited<ReturnType<typeof createBoardApiV1BoardsPost>>
>;
export type CreateBoardApiV1BoardsPostMutationBody = BoardCreate;
export type CreateBoardApiV1BoardsPostMutationError = HTTPValidationError;

/**
 * @summary Create Board
 */
export const useCreateBoardApiV1BoardsPost = <
  TError = HTTPValidationError,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof createBoardApiV1BoardsPost>>,
      TError,
      { data: BoardCreate },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof createBoardApiV1BoardsPost>>,
  TError,
  { data: BoardCreate },
  TContext
> => {
  return useMutation(
    getCreateBoardApiV1BoardsPostMutationOptions(options),
    queryClient,
  );
};
/**
 * Delete a board and all dependent records.
 * @summary Delete Board
 */
export type deleteBoardApiV1BoardsBoardIdDeleteResponse200 = {
  data: OkResponse;
  status: 200;
};

export type deleteBoardApiV1BoardsBoardIdDeleteResponse422 = {
  data: HTTPValidationError;
  status: 422;
};

export type deleteBoardApiV1BoardsBoardIdDeleteResponseSuccess =
  deleteBoardApiV1BoardsBoardIdDeleteResponse200 & {
    headers: Headers;
  };
export type deleteBoardApiV1BoardsBoardIdDeleteResponseError =
  deleteBoardApiV1BoardsBoardIdDeleteResponse422 & {
    headers: Headers;
  };

export type deleteBoardApiV1BoardsBoardIdDeleteResponse =
  | deleteBoardApiV1BoardsBoardIdDeleteResponseSuccess
  | deleteBoardApiV1BoardsBoardIdDeleteResponseError;

export const getDeleteBoardApiV1BoardsBoardIdDeleteUrl = (boardId: string) => {
  return `/api/v1/boards/${boardId}`;
};

export const deleteBoardApiV1BoardsBoardIdDelete = async (
  boardId: string,
  options?: RequestInit,
): Promise<deleteBoardApiV1BoardsBoardIdDeleteResponse> => {
  return customFetch<deleteBoardApiV1BoardsBoardIdDeleteResponse>(
    getDeleteBoardApiV1BoardsBoardIdDeleteUrl(boardId),
    {
      ...options,
      method: "DELETE",
    },
  );
};

export const getDeleteBoardApiV1BoardsBoardIdDeleteMutationOptions = <
  TError = HTTPValidationError,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof deleteBoardApiV1BoardsBoardIdDelete>>,
    TError,
    { boardId: string },
    TContext
  >;
  request?: SecondParameter<typeof customFetch>;
}): UseMutationOptions<
  Awaited<ReturnType<typeof deleteBoardApiV1BoardsBoardIdDelete>>,
  TError,
  { boardId: string },
  TContext
> => {
  const mutationKey = ["deleteBoardApiV1BoardsBoardIdDelete"];
  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 deleteBoardApiV1BoardsBoardIdDelete>>,
    { boardId: string }
  > = (props) => {
    const { boardId } = props ?? {};

    return deleteBoardApiV1BoardsBoardIdDelete(boardId, requestOptions);
  };

  return { mutationFn, ...mutationOptions };
};

export type DeleteBoardApiV1BoardsBoardIdDeleteMutationResult = NonNullable<
  Awaited<ReturnType<typeof deleteBoardApiV1BoardsBoardIdDelete>>
>;

export type DeleteBoardApiV1BoardsBoardIdDeleteMutationError =
  HTTPValidationError;

/**
 * @summary Delete Board
 */
export const useDeleteBoardApiV1BoardsBoardIdDelete = <
  TError = HTTPValidationError,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof deleteBoardApiV1BoardsBoardIdDelete>>,
      TError,
      { boardId: string },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof deleteBoardApiV1BoardsBoardIdDelete>>,
  TError,
  { boardId: string },
  TContext
> => {
  return useMutation(
    getDeleteBoardApiV1BoardsBoardIdDeleteMutationOptions(options),
    queryClient,
  );
};
/**
 * Get a board by id.
 * @summary Get Board
 */
export type getBoardApiV1BoardsBoardIdGetResponse200 = {
  data: BoardRead;
  status: 200;
};

export type getBoardApiV1BoardsBoardIdGetResponse422 = {
  data: HTTPValidationError;
  status: 422;
};

export type getBoardApiV1BoardsBoardIdGetResponseSuccess =
  getBoardApiV1BoardsBoardIdGetResponse200 & {
    headers: Headers;
  };
export type getBoardApiV1BoardsBoardIdGetResponseError =
  getBoardApiV1BoardsBoardIdGetResponse422 & {
    headers: Headers;
  };

export type getBoardApiV1BoardsBoardIdGetResponse =
  | getBoardApiV1BoardsBoardIdGetResponseSuccess
  | getBoardApiV1BoardsBoardIdGetResponseError;

export const getGetBoardApiV1BoardsBoardIdGetUrl = (boardId: string) => {
  return `/api/v1/boards/${boardId}`;
};

export const getBoardApiV1BoardsBoardIdGet = async (
  boardId: string,
  options?: RequestInit,
): Promise<getBoardApiV1BoardsBoardIdGetResponse> => {
  return customFetch<getBoardApiV1BoardsBoardIdGetResponse>(
    getGetBoardApiV1BoardsBoardIdGetUrl(boardId),
    {
      ...options,
      method: "GET",
    },
  );
};

export const getGetBoardApiV1BoardsBoardIdGetQueryKey = (boardId: string) => {
  return [`/api/v1/boards/${boardId}`] as const;
};

export const getGetBoardApiV1BoardsBoardIdGetQueryOptions = <
  TData = Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
  TError = HTTPValidationError,
>(
  boardId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

  const queryKey =
    queryOptions?.queryKey ?? getGetBoardApiV1BoardsBoardIdGetQueryKey(boardId);

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

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

export type GetBoardApiV1BoardsBoardIdGetQueryResult = NonNullable<
  Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>
>;
export type GetBoardApiV1BoardsBoardIdGetQueryError = HTTPValidationError;

export function useGetBoardApiV1BoardsBoardIdGet<
  TData = Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
  TError = HTTPValidationError,
>(
  boardId: string,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
          TError,
          Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardApiV1BoardsBoardIdGet<
  TData = Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
  TError = HTTPValidationError,
>(
  boardId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
          TError,
          Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardApiV1BoardsBoardIdGet<
  TData = Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
  TError = HTTPValidationError,
>(
  boardId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get Board
 */

export function useGetBoardApiV1BoardsBoardIdGet<
  TData = Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
  TError = HTTPValidationError,
>(
  boardId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof getBoardApiV1BoardsBoardIdGet>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getGetBoardApiV1BoardsBoardIdGetQueryOptions(
    boardId,
    options,
  );

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

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

/**
 * Update mutable board properties.
 * @summary Update Board
 */
export type updateBoardApiV1BoardsBoardIdPatchResponse200 = {
  data: BoardRead;
  status: 200;
};

export type updateBoardApiV1BoardsBoardIdPatchResponse422 = {
  data: HTTPValidationError;
  status: 422;
};

export type updateBoardApiV1BoardsBoardIdPatchResponseSuccess =
  updateBoardApiV1BoardsBoardIdPatchResponse200 & {
    headers: Headers;
  };
export type updateBoardApiV1BoardsBoardIdPatchResponseError =
  updateBoardApiV1BoardsBoardIdPatchResponse422 & {
    headers: Headers;
  };

export type updateBoardApiV1BoardsBoardIdPatchResponse =
  | updateBoardApiV1BoardsBoardIdPatchResponseSuccess
  | updateBoardApiV1BoardsBoardIdPatchResponseError;

export const getUpdateBoardApiV1BoardsBoardIdPatchUrl = (boardId: string) => {
  return `/api/v1/boards/${boardId}`;
};

export const updateBoardApiV1BoardsBoardIdPatch = async (
  boardId: string,
  boardUpdate: BoardUpdate,
  options?: RequestInit,
): Promise<updateBoardApiV1BoardsBoardIdPatchResponse> => {
  return customFetch<updateBoardApiV1BoardsBoardIdPatchResponse>(
    getUpdateBoardApiV1BoardsBoardIdPatchUrl(boardId),
    {
      ...options,
      method: "PATCH",
      headers: { "Content-Type": "application/json", ...options?.headers },
      body: JSON.stringify(boardUpdate),
    },
  );
};

export const getUpdateBoardApiV1BoardsBoardIdPatchMutationOptions = <
  TError = HTTPValidationError,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof updateBoardApiV1BoardsBoardIdPatch>>,
    TError,
    { boardId: string; data: BoardUpdate },
    TContext
  >;
  request?: SecondParameter<typeof customFetch>;
}): UseMutationOptions<
  Awaited<ReturnType<typeof updateBoardApiV1BoardsBoardIdPatch>>,
  TError,
  { boardId: string; data: BoardUpdate },
  TContext
> => {
  const mutationKey = ["updateBoardApiV1BoardsBoardIdPatch"];
  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 updateBoardApiV1BoardsBoardIdPatch>>,
    { boardId: string; data: BoardUpdate }
  > = (props) => {
    const { boardId, data } = props ?? {};

    return updateBoardApiV1BoardsBoardIdPatch(boardId, data, requestOptions);
  };

  return { mutationFn, ...mutationOptions };
};

export type UpdateBoardApiV1BoardsBoardIdPatchMutationResult = NonNullable<
  Awaited<ReturnType<typeof updateBoardApiV1BoardsBoardIdPatch>>
>;
export type UpdateBoardApiV1BoardsBoardIdPatchMutationBody = BoardUpdate;
export type UpdateBoardApiV1BoardsBoardIdPatchMutationError =
  HTTPValidationError;

/**
 * @summary Update Board
 */
export const useUpdateBoardApiV1BoardsBoardIdPatch = <
  TError = HTTPValidationError,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof updateBoardApiV1BoardsBoardIdPatch>>,
      TError,
      { boardId: string; data: BoardUpdate },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof updateBoardApiV1BoardsBoardIdPatch>>,
  TError,
  { boardId: string; data: BoardUpdate },
  TContext
> => {
  return useMutation(
    getUpdateBoardApiV1BoardsBoardIdPatchMutationOptions(options),
    queryClient,
  );
};
/**
 * Get a grouped snapshot across related boards.

Returns high-signal cross-board status for dependency and overlap checks.
 * @summary Get Board Group Snapshot
 */
export type getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponse200 =
  {
    data: BoardGroupSnapshot;
    status: 200;
  };

export type getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponse422 =
  {
    data: HTTPValidationError;
    status: 422;
  };

export type getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponseSuccess =
  getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponse200 & {
    headers: Headers;
  };
export type getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponseError =
  getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponse422 & {
    headers: Headers;
  };

export type getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponse =
  | getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponseSuccess
  | getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponseError;

export const getGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetUrl = (
  boardId: string,
  params?: GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetParams,
) => {
  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/v1/boards/${boardId}/group-snapshot?${stringifiedParams}`
    : `/api/v1/boards/${boardId}/group-snapshot`;
};

export const getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet = async (
  boardId: string,
  params?: GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetParams,
  options?: RequestInit,
): Promise<getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponse> => {
  return customFetch<getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetResponse>(
    getGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetUrl(
      boardId,
      params,
    ),
    {
      ...options,
      method: "GET",
    },
  );
};

export const getGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetQueryKey =
  (
    boardId: string,
    params?: GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetParams,
  ) => {
    return [
      `/api/v1/boards/${boardId}/group-snapshot`,
      ...(params ? [params] : []),
    ] as const;
  };

export const getGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetQueryOptions =
  <
    TData = Awaited<
      ReturnType<typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet>
    >,
    TError = HTTPValidationError,
  >(
    boardId: string,
    params?: GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetParams,
    options?: {
      query?: Partial<
        UseQueryOptions<
          Awaited<
            ReturnType<
              typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet
            >
          >,
          TError,
          TData
        >
      >;
      request?: SecondParameter<typeof customFetch>;
    },
  ) => {
    const { query: queryOptions, request: requestOptions } = options ?? {};

    const queryKey =
      queryOptions?.queryKey ??
      getGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetQueryKey(
        boardId,
        params,
      );

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

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

export type GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetQueryResult =
  NonNullable<
    Awaited<
      ReturnType<typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet>
    >
  >;
export type GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetQueryError =
  HTTPValidationError;

export function useGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet<
  TData = Awaited<
    ReturnType<typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  params:
    | undefined
    | GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetParams,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet
          >
        >,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<
            ReturnType<
              typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet
            >
          >,
          TError,
          Awaited<
            ReturnType<
              typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet
            >
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet<
  TData = Awaited<
    ReturnType<typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  params?: GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet
          >
        >,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<
            ReturnType<
              typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet
            >
          >,
          TError,
          Awaited<
            ReturnType<
              typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet
            >
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet<
  TData = Awaited<
    ReturnType<typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  params?: GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet
          >
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get Board Group Snapshot
 */

export function useGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet<
  TData = Awaited<
    ReturnType<typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  params?: GetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGet
          >
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions =
    getGetBoardGroupSnapshotApiV1BoardsBoardIdGroupSnapshotGetQueryOptions(
      boardId,
      params,
      options,
    );

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

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

/**
 * Get a board snapshot view model.
 * @summary Get Board Snapshot
 */
export type getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponse200 = {
  data: BoardSnapshot;
  status: 200;
};

export type getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponse422 = {
  data: HTTPValidationError;
  status: 422;
};

export type getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponseSuccess =
  getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponse200 & {
    headers: Headers;
  };
export type getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponseError =
  getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponse422 & {
    headers: Headers;
  };

export type getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponse =
  | getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponseSuccess
  | getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponseError;

export const getGetBoardSnapshotApiV1BoardsBoardIdSnapshotGetUrl = (
  boardId: string,
) => {
  return `/api/v1/boards/${boardId}/snapshot`;
};

export const getBoardSnapshotApiV1BoardsBoardIdSnapshotGet = async (
  boardId: string,
  options?: RequestInit,
): Promise<getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponse> => {
  return customFetch<getBoardSnapshotApiV1BoardsBoardIdSnapshotGetResponse>(
    getGetBoardSnapshotApiV1BoardsBoardIdSnapshotGetUrl(boardId),
    {
      ...options,
      method: "GET",
    },
  );
};

export const getGetBoardSnapshotApiV1BoardsBoardIdSnapshotGetQueryKey = (
  boardId: string,
) => {
  return [`/api/v1/boards/${boardId}/snapshot`] as const;
};

export const getGetBoardSnapshotApiV1BoardsBoardIdSnapshotGetQueryOptions = <
  TData = Awaited<
    ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

  const queryKey =
    queryOptions?.queryKey ??
    getGetBoardSnapshotApiV1BoardsBoardIdSnapshotGetQueryKey(boardId);

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

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

export type GetBoardSnapshotApiV1BoardsBoardIdSnapshotGetQueryResult =
  NonNullable<
    Awaited<ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>>
  >;
export type GetBoardSnapshotApiV1BoardsBoardIdSnapshotGetQueryError =
  HTTPValidationError;

export function useGetBoardSnapshotApiV1BoardsBoardIdSnapshotGet<
  TData = Awaited<
    ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
        >,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<
            ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
          >,
          TError,
          Awaited<
            ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardSnapshotApiV1BoardsBoardIdSnapshotGet<
  TData = Awaited<
    ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
        >,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<
            ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
          >,
          TError,
          Awaited<
            ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardSnapshotApiV1BoardsBoardIdSnapshotGet<
  TData = Awaited<
    ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get Board Snapshot
 */

export function useGetBoardSnapshotApiV1BoardsBoardIdSnapshotGet<
  TData = Awaited<
    ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof getBoardSnapshotApiV1BoardsBoardIdSnapshotGet>
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions =
    getGetBoardSnapshotApiV1BoardsBoardIdSnapshotGetQueryOptions(
      boardId,
      options,
    );

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

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