/**
 * Generated by orval v6.31.0 🍺
 * Do not edit manually.
 * pkh-api
 * pkh api
 * OpenAPI spec version: 0.0.1
 */
import { faker } from '@faker-js/faker';
import { HttpResponse, delay, http } from 'msw';
import type { AuthenticationControllerLogin200 } from '../../models';

export const getAuthenticationControllerLoginResponseMock = (
  overrideResponse: Partial<AuthenticationControllerLogin200> = {},
): AuthenticationControllerLogin200 => ({
  token: faker.helpers.arrayElement([faker.word.sample(), undefined]),
  ...overrideResponse,
});

export const getAuthenticationControllerLoginMockHandler = (
  overrideResponse?:
    | AuthenticationControllerLogin200
    | ((
        info: Parameters<Parameters<typeof http.post>[1]>[0],
      ) => Promise<AuthenticationControllerLogin200> | AuthenticationControllerLogin200),
) => {
  return http.post('*/users/login', async (info) => {
    await delay(1000);
    return new HttpResponse(
      JSON.stringify(
        overrideResponse !== undefined
          ? typeof overrideResponse === 'function'
            ? await overrideResponse(info)
            : overrideResponse
          : getAuthenticationControllerLoginResponseMock(),
      ),
      {
        status: 200,
        headers: {
          'Content-Type': 'application/json',
        },
      },
    );
  });
};
export const getAuthenticationControllerMock = () => [getAuthenticationControllerLoginMockHandler()];
