/**
 * Generated by orval 🍺
 * Do not edit manually.
 * messages API
 * This is the messages API schema.
 * OpenAPI spec version: 1.0.0 (v1.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 {
  DeliveryStatusUpdateResponse,
  DraftCreate2400,
  DraftCreate2403,
  DraftCreate2404,
  DraftCreate400,
  DraftCreate403,
  DraftCreate404,
  DraftMessageRequestRequest,
  DraftPlaceholdersRetrieve200,
  DraftUpdate2400,
  DraftUpdate2403,
  DraftUpdate2404,
  DraftUpdate400,
  DraftUpdate403,
  DraftUpdate404,
  Message,
  MessageDeliveryStatusChoices,
  MessagesDeliveryStatusesPartialUpdateBodyOne,
  SendCreate400,
  SendCreate403,
  SendCreate503,
  SendMessageRequest,
  SendMessageResponse,
} from ".././models";

import { fetchAPI } from "../../fetch-api";

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

/**
 * 
    Create or update a draft message.
    
    This endpoint allows you to:
    - Create a new draft message in a new thread
    - Create a draft reply to an existing message in an existing thread
    - Update an existing draft message
    
    For creating a new draft:
    - Do not include messageId
    - Include parentId if replying to an existing message
    
    For updating an existing draft:
    - Include messageId of the draft to update
    - Only the fields that are provided will be updated
    
    At least one of draftBody must be provided.
    
    To add attachments, upload them first using the /api/v1.0/blob/upload/{mailbox_id}/ endpoint
    and include the returned blobIds in the attachmentIds field.
    
 */
export type draftCreateResponse200 = {
  data: Message;
  status: 200;
};

export type draftCreateResponse201 = {
  data: Message;
  status: 201;
};

export type draftCreateResponse400 = {
  data: DraftCreate400;
  status: 400;
};

export type draftCreateResponse403 = {
  data: DraftCreate403;
  status: 403;
};

export type draftCreateResponse404 = {
  data: DraftCreate404;
  status: 404;
};

export type draftCreateResponseSuccess = (
  | draftCreateResponse200
  | draftCreateResponse201
) & {
  headers: Headers;
};
export type draftCreateResponseError = (
  | draftCreateResponse400
  | draftCreateResponse403
  | draftCreateResponse404
) & {
  headers: Headers;
};

export type draftCreateResponse =
  | draftCreateResponseSuccess
  | draftCreateResponseError;

export const getDraftCreateUrl = () => {
  return `/api/v1.0/draft/`;
};

export const draftCreate = async (
  draftMessageRequestRequest: DraftMessageRequestRequest,
  options?: RequestInit,
): Promise<draftCreateResponse> => {
  return fetchAPI<draftCreateResponse>(getDraftCreateUrl(), {
    ...options,
    method: "POST",
    headers: { "Content-Type": "application/json", ...options?.headers },
    body: JSON.stringify(draftMessageRequestRequest),
  });
};

export const getDraftCreateMutationOptions = <
  TError = DraftCreate400 | DraftCreate403 | DraftCreate404,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof draftCreate>>,
    TError,
    { data: DraftMessageRequestRequest },
    TContext
  >;
  request?: SecondParameter<typeof fetchAPI>;
}): UseMutationOptions<
  Awaited<ReturnType<typeof draftCreate>>,
  TError,
  { data: DraftMessageRequestRequest },
  TContext
> => {
  const mutationKey = ["draftCreate"];
  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 draftCreate>>,
    { data: DraftMessageRequestRequest }
  > = (props) => {
    const { data } = props ?? {};

    return draftCreate(data, requestOptions);
  };

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

export type DraftCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof draftCreate>>
>;
export type DraftCreateMutationBody = DraftMessageRequestRequest;
export type DraftCreateMutationError =
  | DraftCreate400
  | DraftCreate403
  | DraftCreate404;

export const useDraftCreate = <
  TError = DraftCreate400 | DraftCreate403 | DraftCreate404,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof draftCreate>>,
      TError,
      { data: DraftMessageRequestRequest },
      TContext
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof draftCreate>>,
  TError,
  { data: DraftMessageRequestRequest },
  TContext
> => {
  const mutationOptions = getDraftCreateMutationOptions(options);

  return useMutation(mutationOptions, queryClient);
};
/**
 * 
    Create or update a draft message.
    
    This endpoint allows you to:
    - Create a new draft message in a new thread
    - Create a draft reply to an existing message in an existing thread
    - Update an existing draft message
    
    For creating a new draft:
    - Do not include messageId
    - Include parentId if replying to an existing message
    
    For updating an existing draft:
    - Include messageId of the draft to update
    - Only the fields that are provided will be updated
    
    At least one of draftBody must be provided.
    
    To add attachments, upload them first using the /api/v1.0/blob/upload/{mailbox_id}/ endpoint
    and include the returned blobIds in the attachmentIds field.
    
 */
export type draftUpdateResponse200 = {
  data: Message;
  status: 200;
};

export type draftUpdateResponse201 = {
  data: Message;
  status: 201;
};

export type draftUpdateResponse400 = {
  data: DraftUpdate400;
  status: 400;
};

export type draftUpdateResponse403 = {
  data: DraftUpdate403;
  status: 403;
};

export type draftUpdateResponse404 = {
  data: DraftUpdate404;
  status: 404;
};

export type draftUpdateResponseSuccess = (
  | draftUpdateResponse200
  | draftUpdateResponse201
) & {
  headers: Headers;
};
export type draftUpdateResponseError = (
  | draftUpdateResponse400
  | draftUpdateResponse403
  | draftUpdateResponse404
) & {
  headers: Headers;
};

export type draftUpdateResponse =
  | draftUpdateResponseSuccess
  | draftUpdateResponseError;

export const getDraftUpdateUrl = () => {
  return `/api/v1.0/draft/`;
};

export const draftUpdate = async (
  draftMessageRequestRequest: DraftMessageRequestRequest,
  options?: RequestInit,
): Promise<draftUpdateResponse> => {
  return fetchAPI<draftUpdateResponse>(getDraftUpdateUrl(), {
    ...options,
    method: "PUT",
    headers: { "Content-Type": "application/json", ...options?.headers },
    body: JSON.stringify(draftMessageRequestRequest),
  });
};

export const getDraftUpdateMutationOptions = <
  TError = DraftUpdate400 | DraftUpdate403 | DraftUpdate404,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof draftUpdate>>,
    TError,
    { data: DraftMessageRequestRequest },
    TContext
  >;
  request?: SecondParameter<typeof fetchAPI>;
}): UseMutationOptions<
  Awaited<ReturnType<typeof draftUpdate>>,
  TError,
  { data: DraftMessageRequestRequest },
  TContext
> => {
  const mutationKey = ["draftUpdate"];
  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 draftUpdate>>,
    { data: DraftMessageRequestRequest }
  > = (props) => {
    const { data } = props ?? {};

    return draftUpdate(data, requestOptions);
  };

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

export type DraftUpdateMutationResult = NonNullable<
  Awaited<ReturnType<typeof draftUpdate>>
>;
export type DraftUpdateMutationBody = DraftMessageRequestRequest;
export type DraftUpdateMutationError =
  | DraftUpdate400
  | DraftUpdate403
  | DraftUpdate404;

export const useDraftUpdate = <
  TError = DraftUpdate400 | DraftUpdate403 | DraftUpdate404,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof draftUpdate>>,
      TError,
      { data: DraftMessageRequestRequest },
      TContext
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof draftUpdate>>,
  TError,
  { data: DraftMessageRequestRequest },
  TContext
> => {
  const mutationOptions = getDraftUpdateMutationOptions(options);

  return useMutation(mutationOptions, queryClient);
};
/**
 * 
    Create or update a draft message.
    
    This endpoint allows you to:
    - Create a new draft message in a new thread
    - Create a draft reply to an existing message in an existing thread
    - Update an existing draft message
    
    For creating a new draft:
    - Do not include messageId
    - Include parentId if replying to an existing message
    
    For updating an existing draft:
    - Include messageId of the draft to update
    - Only the fields that are provided will be updated
    
    At least one of draftBody must be provided.
    
    To add attachments, upload them first using the /api/v1.0/blob/upload/{mailbox_id}/ endpoint
    and include the returned blobIds in the attachmentIds field.
    
 */
export type draftCreate2Response200 = {
  data: Message;
  status: 200;
};

export type draftCreate2Response201 = {
  data: Message;
  status: 201;
};

export type draftCreate2Response400 = {
  data: DraftCreate2400;
  status: 400;
};

export type draftCreate2Response403 = {
  data: DraftCreate2403;
  status: 403;
};

export type draftCreate2Response404 = {
  data: DraftCreate2404;
  status: 404;
};

export type draftCreate2ResponseSuccess = (
  | draftCreate2Response200
  | draftCreate2Response201
) & {
  headers: Headers;
};
export type draftCreate2ResponseError = (
  | draftCreate2Response400
  | draftCreate2Response403
  | draftCreate2Response404
) & {
  headers: Headers;
};

export type draftCreate2Response =
  | draftCreate2ResponseSuccess
  | draftCreate2ResponseError;

export const getDraftCreate2Url = (messageId: string) => {
  return `/api/v1.0/draft/${messageId}/`;
};

export const draftCreate2 = async (
  messageId: string,
  draftMessageRequestRequest: DraftMessageRequestRequest,
  options?: RequestInit,
): Promise<draftCreate2Response> => {
  return fetchAPI<draftCreate2Response>(getDraftCreate2Url(messageId), {
    ...options,
    method: "POST",
    headers: { "Content-Type": "application/json", ...options?.headers },
    body: JSON.stringify(draftMessageRequestRequest),
  });
};

export const getDraftCreate2MutationOptions = <
  TError = DraftCreate2400 | DraftCreate2403 | DraftCreate2404,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof draftCreate2>>,
    TError,
    { messageId: string; data: DraftMessageRequestRequest },
    TContext
  >;
  request?: SecondParameter<typeof fetchAPI>;
}): UseMutationOptions<
  Awaited<ReturnType<typeof draftCreate2>>,
  TError,
  { messageId: string; data: DraftMessageRequestRequest },
  TContext
> => {
  const mutationKey = ["draftCreate2"];
  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 draftCreate2>>,
    { messageId: string; data: DraftMessageRequestRequest }
  > = (props) => {
    const { messageId, data } = props ?? {};

    return draftCreate2(messageId, data, requestOptions);
  };

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

export type DraftCreate2MutationResult = NonNullable<
  Awaited<ReturnType<typeof draftCreate2>>
>;
export type DraftCreate2MutationBody = DraftMessageRequestRequest;
export type DraftCreate2MutationError =
  | DraftCreate2400
  | DraftCreate2403
  | DraftCreate2404;

export const useDraftCreate2 = <
  TError = DraftCreate2400 | DraftCreate2403 | DraftCreate2404,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof draftCreate2>>,
      TError,
      { messageId: string; data: DraftMessageRequestRequest },
      TContext
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof draftCreate2>>,
  TError,
  { messageId: string; data: DraftMessageRequestRequest },
  TContext
> => {
  const mutationOptions = getDraftCreate2MutationOptions(options);

  return useMutation(mutationOptions, queryClient);
};
/**
 * 
    Create or update a draft message.
    
    This endpoint allows you to:
    - Create a new draft message in a new thread
    - Create a draft reply to an existing message in an existing thread
    - Update an existing draft message
    
    For creating a new draft:
    - Do not include messageId
    - Include parentId if replying to an existing message
    
    For updating an existing draft:
    - Include messageId of the draft to update
    - Only the fields that are provided will be updated
    
    At least one of draftBody must be provided.
    
    To add attachments, upload them first using the /api/v1.0/blob/upload/{mailbox_id}/ endpoint
    and include the returned blobIds in the attachmentIds field.
    
 */
export type draftUpdate2Response200 = {
  data: Message;
  status: 200;
};

export type draftUpdate2Response201 = {
  data: Message;
  status: 201;
};

export type draftUpdate2Response400 = {
  data: DraftUpdate2400;
  status: 400;
};

export type draftUpdate2Response403 = {
  data: DraftUpdate2403;
  status: 403;
};

export type draftUpdate2Response404 = {
  data: DraftUpdate2404;
  status: 404;
};

export type draftUpdate2ResponseSuccess = (
  | draftUpdate2Response200
  | draftUpdate2Response201
) & {
  headers: Headers;
};
export type draftUpdate2ResponseError = (
  | draftUpdate2Response400
  | draftUpdate2Response403
  | draftUpdate2Response404
) & {
  headers: Headers;
};

export type draftUpdate2Response =
  | draftUpdate2ResponseSuccess
  | draftUpdate2ResponseError;

export const getDraftUpdate2Url = (messageId: string) => {
  return `/api/v1.0/draft/${messageId}/`;
};

export const draftUpdate2 = async (
  messageId: string,
  draftMessageRequestRequest: DraftMessageRequestRequest,
  options?: RequestInit,
): Promise<draftUpdate2Response> => {
  return fetchAPI<draftUpdate2Response>(getDraftUpdate2Url(messageId), {
    ...options,
    method: "PUT",
    headers: { "Content-Type": "application/json", ...options?.headers },
    body: JSON.stringify(draftMessageRequestRequest),
  });
};

export const getDraftUpdate2MutationOptions = <
  TError = DraftUpdate2400 | DraftUpdate2403 | DraftUpdate2404,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof draftUpdate2>>,
    TError,
    { messageId: string; data: DraftMessageRequestRequest },
    TContext
  >;
  request?: SecondParameter<typeof fetchAPI>;
}): UseMutationOptions<
  Awaited<ReturnType<typeof draftUpdate2>>,
  TError,
  { messageId: string; data: DraftMessageRequestRequest },
  TContext
> => {
  const mutationKey = ["draftUpdate2"];
  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 draftUpdate2>>,
    { messageId: string; data: DraftMessageRequestRequest }
  > = (props) => {
    const { messageId, data } = props ?? {};

    return draftUpdate2(messageId, data, requestOptions);
  };

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

export type DraftUpdate2MutationResult = NonNullable<
  Awaited<ReturnType<typeof draftUpdate2>>
>;
export type DraftUpdate2MutationBody = DraftMessageRequestRequest;
export type DraftUpdate2MutationError =
  | DraftUpdate2400
  | DraftUpdate2403
  | DraftUpdate2404;

export const useDraftUpdate2 = <
  TError = DraftUpdate2400 | DraftUpdate2403 | DraftUpdate2404,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof draftUpdate2>>,
      TError,
      { messageId: string; data: DraftMessageRequestRequest },
      TContext
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof draftUpdate2>>,
  TError,
  { messageId: string; data: DraftMessageRequestRequest },
  TContext
> => {
  const mutationOptions = getDraftUpdate2MutationOptions(options);

  return useMutation(mutationOptions, queryClient);
};
/**
 * Resolve placeholder values for the authenticated user in the context of a draft message. The mailbox is derived from the draft's sender. recipient_name is resolved from the draft's TO recipients.
 * @summary Resolve placeholder values for a draft
 */
export type draftPlaceholdersRetrieveResponse200 = {
  data: DraftPlaceholdersRetrieve200;
  status: 200;
};

export type draftPlaceholdersRetrieveResponse404 = {
  data: unknown;
  status: 404;
};

export type draftPlaceholdersRetrieveResponseSuccess =
  draftPlaceholdersRetrieveResponse200 & {
    headers: Headers;
  };
export type draftPlaceholdersRetrieveResponseError =
  draftPlaceholdersRetrieveResponse404 & {
    headers: Headers;
  };

export type draftPlaceholdersRetrieveResponse =
  | draftPlaceholdersRetrieveResponseSuccess
  | draftPlaceholdersRetrieveResponseError;

export const getDraftPlaceholdersRetrieveUrl = (messageId: string) => {
  return `/api/v1.0/draft/${messageId}/placeholders/`;
};

export const draftPlaceholdersRetrieve = async (
  messageId: string,
  options?: RequestInit,
): Promise<draftPlaceholdersRetrieveResponse> => {
  return fetchAPI<draftPlaceholdersRetrieveResponse>(
    getDraftPlaceholdersRetrieveUrl(messageId),
    {
      ...options,
      method: "GET",
    },
  );
};

export const getDraftPlaceholdersRetrieveQueryKey = (messageId?: string) => {
  return [`/api/v1.0/draft/${messageId}/placeholders/`] as const;
};

export const getDraftPlaceholdersRetrieveQueryOptions = <
  TData = Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
  TError = unknown,
>(
  messageId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

  const queryKey =
    queryOptions?.queryKey ?? getDraftPlaceholdersRetrieveQueryKey(messageId);

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

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

export type DraftPlaceholdersRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>
>;
export type DraftPlaceholdersRetrieveQueryError = unknown;

export function useDraftPlaceholdersRetrieve<
  TData = Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
  TError = unknown,
>(
  messageId: string,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
          TError,
          Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useDraftPlaceholdersRetrieve<
  TData = Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
  TError = unknown,
>(
  messageId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
          TError,
          Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useDraftPlaceholdersRetrieve<
  TData = Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
  TError = unknown,
>(
  messageId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Resolve placeholder values for a draft
 */

export function useDraftPlaceholdersRetrieve<
  TData = Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
  TError = unknown,
>(
  messageId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof draftPlaceholdersRetrieve>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getDraftPlaceholdersRetrieveQueryOptions(
    messageId,
    options,
  );

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

  query.queryKey = queryOptions.queryKey;

  return query;
}

/**
 * ViewSet for Message model.
 */
export type messagesListResponse200 = {
  data: Message[];
  status: 200;
};

export type messagesListResponseSuccess = messagesListResponse200 & {
  headers: Headers;
};
export type messagesListResponse = messagesListResponseSuccess;

export const getMessagesListUrl = () => {
  return `/api/v1.0/messages/`;
};

export const messagesList = async (
  options?: RequestInit,
): Promise<messagesListResponse> => {
  return fetchAPI<messagesListResponse>(getMessagesListUrl(), {
    ...options,
    method: "GET",
  });
};

export const getMessagesListQueryKey = () => {
  return [`/api/v1.0/messages/`] as const;
};

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

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

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

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

export type MessagesListQueryResult = NonNullable<
  Awaited<ReturnType<typeof messagesList>>
>;
export type MessagesListQueryError = unknown;

export function useMessagesList<
  TData = Awaited<ReturnType<typeof messagesList>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<Awaited<ReturnType<typeof messagesList>>, TError, TData>
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof messagesList>>,
          TError,
          Awaited<ReturnType<typeof messagesList>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useMessagesList<
  TData = Awaited<ReturnType<typeof messagesList>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<Awaited<ReturnType<typeof messagesList>>, TError, TData>
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof messagesList>>,
          TError,
          Awaited<ReturnType<typeof messagesList>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useMessagesList<
  TData = Awaited<ReturnType<typeof messagesList>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<Awaited<ReturnType<typeof messagesList>>, TError, TData>
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

  query.queryKey = queryOptions.queryKey;

  return query;
}

/**
 * ViewSet for Message model.
 */
export type messagesRetrieveResponse200 = {
  data: Message;
  status: 200;
};

export type messagesRetrieveResponseSuccess = messagesRetrieveResponse200 & {
  headers: Headers;
};
export type messagesRetrieveResponse = messagesRetrieveResponseSuccess;

export const getMessagesRetrieveUrl = (id: string) => {
  return `/api/v1.0/messages/${id}/`;
};

export const messagesRetrieve = async (
  id: string,
  options?: RequestInit,
): Promise<messagesRetrieveResponse> => {
  return fetchAPI<messagesRetrieveResponse>(getMessagesRetrieveUrl(id), {
    ...options,
    method: "GET",
  });
};

export const getMessagesRetrieveQueryKey = (id?: string) => {
  return [`/api/v1.0/messages/${id}/`] as const;
};

export const getMessagesRetrieveQueryOptions = <
  TData = Awaited<ReturnType<typeof messagesRetrieve>>,
  TError = unknown,
>(
  id: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesRetrieve>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

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

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

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

export type MessagesRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof messagesRetrieve>>
>;
export type MessagesRetrieveQueryError = unknown;

export function useMessagesRetrieve<
  TData = Awaited<ReturnType<typeof messagesRetrieve>>,
  TError = unknown,
>(
  id: string,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof messagesRetrieve>>,
          TError,
          Awaited<ReturnType<typeof messagesRetrieve>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useMessagesRetrieve<
  TData = Awaited<ReturnType<typeof messagesRetrieve>>,
  TError = unknown,
>(
  id: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof messagesRetrieve>>,
          TError,
          Awaited<ReturnType<typeof messagesRetrieve>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useMessagesRetrieve<
  TData = Awaited<ReturnType<typeof messagesRetrieve>>,
  TError = unknown,
>(
  id: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesRetrieve>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

export function useMessagesRetrieve<
  TData = Awaited<ReturnType<typeof messagesRetrieve>>,
  TError = unknown,
>(
  id: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesRetrieve>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getMessagesRetrieveQueryOptions(id, options);

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

  query.queryKey = queryOptions.queryKey;

  return query;
}

/**
 * Delete a message. Object permission checked by IsAllowedToAccess.
 */
export type messagesDestroyResponse204 = {
  data: void;
  status: 204;
};

export type messagesDestroyResponseSuccess = messagesDestroyResponse204 & {
  headers: Headers;
};
export type messagesDestroyResponse = messagesDestroyResponseSuccess;

export const getMessagesDestroyUrl = (id: string) => {
  return `/api/v1.0/messages/${id}/`;
};

export const messagesDestroy = async (
  id: string,
  options?: RequestInit,
): Promise<messagesDestroyResponse> => {
  return fetchAPI<messagesDestroyResponse>(getMessagesDestroyUrl(id), {
    ...options,
    method: "DELETE",
  });
};

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

    return messagesDestroy(id, requestOptions);
  };

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

export type MessagesDestroyMutationResult = NonNullable<
  Awaited<ReturnType<typeof messagesDestroy>>
>;

export type MessagesDestroyMutationError = unknown;

export const useMessagesDestroy = <TError = unknown, TContext = unknown>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof messagesDestroy>>,
      TError,
      { id: string },
      TContext
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof messagesDestroy>>,
  TError,
  { id: string },
  TContext
> => {
  const mutationOptions = getMessagesDestroyMutationOptions(options);

  return useMutation(mutationOptions, queryClient);
};
/**
 * Update delivery status of message recipients.

Request body should be a dict mapping MessageRecipient IDs to target statuses.
Example: {"recipient_id_1": "cancelled", "recipient_id_2": "retry"}

Allowed transitions:
- FAILED -> CANCELLED
- FAILED -> RETRY manual retry, only for messages sent within the configured max age: MESSAGES_MANUAL_RETRY_MAX_AGE
- RETRY -> CANCELLED
 */
export type messagesDeliveryStatusesPartialUpdateResponse200 = {
  data: DeliveryStatusUpdateResponse;
  status: 200;
};

export type messagesDeliveryStatusesPartialUpdateResponseSuccess =
  messagesDeliveryStatusesPartialUpdateResponse200 & {
    headers: Headers;
  };
export type messagesDeliveryStatusesPartialUpdateResponse =
  messagesDeliveryStatusesPartialUpdateResponseSuccess;

export const getMessagesDeliveryStatusesPartialUpdateUrl = (id: string) => {
  return `/api/v1.0/messages/${id}/delivery-statuses/`;
};

export const messagesDeliveryStatusesPartialUpdate = async (
  id: string,
  messagesDeliveryStatusesPartialUpdateBody:
    | MessagesDeliveryStatusesPartialUpdateBodyOne
    | MessageDeliveryStatusChoices,
  options?: RequestInit,
): Promise<messagesDeliveryStatusesPartialUpdateResponse> => {
  return fetchAPI<messagesDeliveryStatusesPartialUpdateResponse>(
    getMessagesDeliveryStatusesPartialUpdateUrl(id),
    {
      ...options,
      method: "PATCH",
      body: JSON.stringify(messagesDeliveryStatusesPartialUpdateBody),
    },
  );
};

export const getMessagesDeliveryStatusesPartialUpdateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof messagesDeliveryStatusesPartialUpdate>>,
    TError,
    {
      id: string;
      data:
        | MessagesDeliveryStatusesPartialUpdateBodyOne
        | MessageDeliveryStatusChoices;
    },
    TContext
  >;
  request?: SecondParameter<typeof fetchAPI>;
}): UseMutationOptions<
  Awaited<ReturnType<typeof messagesDeliveryStatusesPartialUpdate>>,
  TError,
  {
    id: string;
    data:
      | MessagesDeliveryStatusesPartialUpdateBodyOne
      | MessageDeliveryStatusChoices;
  },
  TContext
> => {
  const mutationKey = ["messagesDeliveryStatusesPartialUpdate"];
  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 messagesDeliveryStatusesPartialUpdate>>,
    {
      id: string;
      data:
        | MessagesDeliveryStatusesPartialUpdateBodyOne
        | MessageDeliveryStatusChoices;
    }
  > = (props) => {
    const { id, data } = props ?? {};

    return messagesDeliveryStatusesPartialUpdate(id, data, requestOptions);
  };

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

export type MessagesDeliveryStatusesPartialUpdateMutationResult = NonNullable<
  Awaited<ReturnType<typeof messagesDeliveryStatusesPartialUpdate>>
>;
export type MessagesDeliveryStatusesPartialUpdateMutationBody =
  | MessagesDeliveryStatusesPartialUpdateBodyOne
  | MessageDeliveryStatusChoices;
export type MessagesDeliveryStatusesPartialUpdateMutationError = unknown;

export const useMessagesDeliveryStatusesPartialUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof messagesDeliveryStatusesPartialUpdate>>,
      TError,
      {
        id: string;
        data:
          | MessagesDeliveryStatusesPartialUpdateBodyOne
          | MessageDeliveryStatusChoices;
      },
      TContext
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof messagesDeliveryStatusesPartialUpdate>>,
  TError,
  {
    id: string;
    data:
      | MessagesDeliveryStatusesPartialUpdateBodyOne
      | MessageDeliveryStatusChoices;
  },
  TContext
> => {
  const mutationOptions =
    getMessagesDeliveryStatusesPartialUpdateMutationOptions(options);

  return useMutation(mutationOptions, queryClient);
};
/**
 * Return the EML file for a message.
 */
export type messagesEmlRetrieveResponse200 = {
  data: Message;
  status: 200;
};

export type messagesEmlRetrieveResponseSuccess =
  messagesEmlRetrieveResponse200 & {
    headers: Headers;
  };
export type messagesEmlRetrieveResponse = messagesEmlRetrieveResponseSuccess;

export const getMessagesEmlRetrieveUrl = (id: string) => {
  return `/api/v1.0/messages/${id}/eml/`;
};

export const messagesEmlRetrieve = async (
  id: string,
  options?: RequestInit,
): Promise<messagesEmlRetrieveResponse> => {
  return fetchAPI<messagesEmlRetrieveResponse>(getMessagesEmlRetrieveUrl(id), {
    ...options,
    method: "GET",
  });
};

export const getMessagesEmlRetrieveQueryKey = (id?: string) => {
  return [`/api/v1.0/messages/${id}/eml/`] as const;
};

export const getMessagesEmlRetrieveQueryOptions = <
  TData = Awaited<ReturnType<typeof messagesEmlRetrieve>>,
  TError = unknown,
>(
  id: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesEmlRetrieve>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

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

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

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

export type MessagesEmlRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof messagesEmlRetrieve>>
>;
export type MessagesEmlRetrieveQueryError = unknown;

export function useMessagesEmlRetrieve<
  TData = Awaited<ReturnType<typeof messagesEmlRetrieve>>,
  TError = unknown,
>(
  id: string,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesEmlRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof messagesEmlRetrieve>>,
          TError,
          Awaited<ReturnType<typeof messagesEmlRetrieve>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useMessagesEmlRetrieve<
  TData = Awaited<ReturnType<typeof messagesEmlRetrieve>>,
  TError = unknown,
>(
  id: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesEmlRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof messagesEmlRetrieve>>,
          TError,
          Awaited<ReturnType<typeof messagesEmlRetrieve>>
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useMessagesEmlRetrieve<
  TData = Awaited<ReturnType<typeof messagesEmlRetrieve>>,
  TError = unknown,
>(
  id: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesEmlRetrieve>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

export function useMessagesEmlRetrieve<
  TData = Awaited<ReturnType<typeof messagesEmlRetrieve>>,
  TError = unknown,
>(
  id: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof messagesEmlRetrieve>>,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getMessagesEmlRetrieveQueryOptions(id, options);

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

  query.queryKey = queryOptions.queryKey;

  return query;
}

/**
 * 
    Send a previously created draft message.

    This endpoint finalizes and sends a message previously saved as a draft.
    The message content (subject, body, recipients) should be set when creating/updating the draft.
    Returns a task ID that can be used to track the sending status.
    
 */
export type sendCreateResponse200 = {
  data: SendMessageResponse;
  status: 200;
};

export type sendCreateResponse400 = {
  data: SendCreate400;
  status: 400;
};

export type sendCreateResponse403 = {
  data: SendCreate403;
  status: 403;
};

export type sendCreateResponse503 = {
  data: SendCreate503;
  status: 503;
};

export type sendCreateResponseSuccess = sendCreateResponse200 & {
  headers: Headers;
};
export type sendCreateResponseError = (
  | sendCreateResponse400
  | sendCreateResponse403
  | sendCreateResponse503
) & {
  headers: Headers;
};

export type sendCreateResponse =
  | sendCreateResponseSuccess
  | sendCreateResponseError;

export const getSendCreateUrl = () => {
  return `/api/v1.0/send/`;
};

export const sendCreate = async (
  sendMessageRequest: SendMessageRequest,
  options?: RequestInit,
): Promise<sendCreateResponse> => {
  return fetchAPI<sendCreateResponse>(getSendCreateUrl(), {
    ...options,
    method: "POST",
    headers: { "Content-Type": "application/json", ...options?.headers },
    body: JSON.stringify(sendMessageRequest),
  });
};

export const getSendCreateMutationOptions = <
  TError = SendCreate400 | SendCreate403 | SendCreate503,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof sendCreate>>,
    TError,
    { data: SendMessageRequest },
    TContext
  >;
  request?: SecondParameter<typeof fetchAPI>;
}): UseMutationOptions<
  Awaited<ReturnType<typeof sendCreate>>,
  TError,
  { data: SendMessageRequest },
  TContext
> => {
  const mutationKey = ["sendCreate"];
  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 sendCreate>>,
    { data: SendMessageRequest }
  > = (props) => {
    const { data } = props ?? {};

    return sendCreate(data, requestOptions);
  };

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

export type SendCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof sendCreate>>
>;
export type SendCreateMutationBody = SendMessageRequest;
export type SendCreateMutationError =
  | SendCreate400
  | SendCreate403
  | SendCreate503;

export const useSendCreate = <
  TError = SendCreate400 | SendCreate403 | SendCreate503,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof sendCreate>>,
      TError,
      { data: SendMessageRequest },
      TContext
    >;
    request?: SecondParameter<typeof fetchAPI>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof sendCreate>>,
  TError,
  { data: SendMessageRequest },
  TContext
> => {
  const mutationOptions = getSendCreateMutationOptions(options);

  return useMutation(mutationOptions, queryClient);
};
