/* eslint-disable */
// This code is autogenerated using @harnessio/oats-cli.
// Please do not modify this code directly.
import { useMutation, UseMutationOptions } from '@tanstack/react-query';

import type { Project } from '../schemas/Project';
import { fetcher, FetcherOptions } from 'services/fetcher';

export type CreateProjectRequestBody = {
  description?: string;
  projectName: string;
  tags?: string[];
};

export type CreateProjectOkResponse = {
  data?: Project;
};

export type CreateProjectErrorResponse = unknown;

export interface CreateProjectProps extends Omit<FetcherOptions<unknown, CreateProjectRequestBody>, 'url'> {
  body: CreateProjectRequestBody;
}

export function createProject(props: CreateProjectProps): Promise<CreateProjectOkResponse> {
  return fetcher<CreateProjectOkResponse, unknown, CreateProjectRequestBody>({
    url: `/auth/create_project`,
    method: 'POST',
    ...props
  });
}

export type CreateProjectMutationProps<T extends keyof CreateProjectProps> = Omit<CreateProjectProps, T> &
  Partial<Pick<CreateProjectProps, T>>;

/**
 * This API is used to create a project
 */
export function useCreateProjectMutation<T extends keyof CreateProjectProps>(
  props: Pick<Partial<CreateProjectProps>, T>,
  options?: Omit<
    UseMutationOptions<CreateProjectOkResponse, CreateProjectErrorResponse, CreateProjectMutationProps<T>>,
    'mutationKey' | 'mutationFn'
  >
) {
  return useMutation<CreateProjectOkResponse, CreateProjectErrorResponse, CreateProjectMutationProps<T>>(
    (mutateProps: CreateProjectMutationProps<T>) => createProject({ ...props, ...mutateProps } as CreateProjectProps),
    options
  );
}
