/**
 * 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 { KhovtTransThanhKhoan, KhovtTransThanhKhoanWithRelations, LoopbackCount } from '../../models';

export const getKhovtTransThanhKhoanControllerCountResponseMock = (
  overrideResponse: Partial<LoopbackCount> = {},
): LoopbackCount => ({
  count: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
  ...overrideResponse,
});

export const getKhovtTransThanhKhoanControllerFindByIdResponseMock = (
  overrideResponse: Partial<KhovtTransThanhKhoanWithRelations> = {},
): KhovtTransThanhKhoanWithRelations => ({
  dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
  kiemKe: faker.helpers.arrayElement([
    faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
    undefined,
  ]),
  kyThanhKhoan: faker.word.sample(),
  maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  tonCuoiKy: faker.helpers.arrayElement([
    faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
    undefined,
  ]),
  tonDauKy: faker.helpers.arrayElement([
    faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
    undefined,
  ]),
  ...overrideResponse,
});

export const getKhovtTransThanhKhoanControllerCreateResponseMock = (
  overrideResponse: Partial<KhovtTransThanhKhoan> = {},
): KhovtTransThanhKhoan => ({
  dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
  kiemKe: faker.helpers.arrayElement([
    faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
    undefined,
  ]),
  kyThanhKhoan: faker.word.sample(),
  maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  tonCuoiKy: faker.helpers.arrayElement([
    faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
    undefined,
  ]),
  tonDauKy: faker.helpers.arrayElement([
    faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
    undefined,
  ]),
  ...overrideResponse,
});

export const getKhovtTransThanhKhoanControllerFindResponseMock = (): KhovtTransThanhKhoanWithRelations[] =>
  Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
    dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
    kiemKe: faker.helpers.arrayElement([
      faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
      undefined,
    ]),
    kyThanhKhoan: faker.word.sample(),
    maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    tonCuoiKy: faker.helpers.arrayElement([
      faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
      undefined,
    ]),
    tonDauKy: faker.helpers.arrayElement([
      faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
      undefined,
    ]),
  }));

export const getKhovtTransThanhKhoanControllerCountMockHandler = (
  overrideResponse?:
    | LoopbackCount
    | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<LoopbackCount> | LoopbackCount),
) => {
  return http.get('*/khovt-trans-thanh-khoans/count', async (info) => {
    await delay(1000);
    return new HttpResponse(
      JSON.stringify(
        overrideResponse !== undefined
          ? typeof overrideResponse === 'function'
            ? await overrideResponse(info)
            : overrideResponse
          : getKhovtTransThanhKhoanControllerCountResponseMock(),
      ),
      {
        status: 200,
        headers: {
          'Content-Type': 'application/json',
        },
      },
    );
  });
};

export const getKhovtTransThanhKhoanControllerUpdateByIdMockHandler = () => {
  return http.patch('*/khovt-trans-thanh-khoans/:id', async () => {
    await delay(1000);
    return new HttpResponse(null, {
      status: 204,
      headers: {
        'Content-Type': 'application/json',
      },
    });
  });
};

export const getKhovtTransThanhKhoanControllerFindByIdMockHandler = (
  overrideResponse?:
    | KhovtTransThanhKhoanWithRelations
    | ((
        info: Parameters<Parameters<typeof http.get>[1]>[0],
      ) => Promise<KhovtTransThanhKhoanWithRelations> | KhovtTransThanhKhoanWithRelations),
) => {
  return http.get('*/khovt-trans-thanh-khoans/:id', async (info) => {
    await delay(1000);
    return new HttpResponse(
      JSON.stringify(
        overrideResponse !== undefined
          ? typeof overrideResponse === 'function'
            ? await overrideResponse(info)
            : overrideResponse
          : getKhovtTransThanhKhoanControllerFindByIdResponseMock(),
      ),
      {
        status: 200,
        headers: {
          'Content-Type': 'application/json',
        },
      },
    );
  });
};

export const getKhovtTransThanhKhoanControllerDeleteByIdMockHandler = () => {
  return http.delete('*/khovt-trans-thanh-khoans/:id', async () => {
    await delay(1000);
    return new HttpResponse(null, {
      status: 204,
      headers: {
        'Content-Type': 'application/json',
      },
    });
  });
};

export const getKhovtTransThanhKhoanControllerCreateMockHandler = (
  overrideResponse?:
    | KhovtTransThanhKhoan
    | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<KhovtTransThanhKhoan> | KhovtTransThanhKhoan),
) => {
  return http.post('*/khovt-trans-thanh-khoans', async (info) => {
    await delay(1000);
    return new HttpResponse(
      JSON.stringify(
        overrideResponse !== undefined
          ? typeof overrideResponse === 'function'
            ? await overrideResponse(info)
            : overrideResponse
          : getKhovtTransThanhKhoanControllerCreateResponseMock(),
      ),
      {
        status: 200,
        headers: {
          'Content-Type': 'application/json',
        },
      },
    );
  });
};

export const getKhovtTransThanhKhoanControllerFindMockHandler = (
  overrideResponse?:
    | KhovtTransThanhKhoanWithRelations[]
    | ((
        info: Parameters<Parameters<typeof http.get>[1]>[0],
      ) => Promise<KhovtTransThanhKhoanWithRelations[]> | KhovtTransThanhKhoanWithRelations[]),
) => {
  return http.get('*/khovt-trans-thanh-khoans', async (info) => {
    await delay(1000);
    return new HttpResponse(
      JSON.stringify(
        overrideResponse !== undefined
          ? typeof overrideResponse === 'function'
            ? await overrideResponse(info)
            : overrideResponse
          : getKhovtTransThanhKhoanControllerFindResponseMock(),
      ),
      {
        status: 200,
        headers: {
          'Content-Type': 'application/json',
        },
      },
    );
  });
};
export const getKhovtTransThanhKhoanControllerMock = () => [
  getKhovtTransThanhKhoanControllerCountMockHandler(),
  getKhovtTransThanhKhoanControllerUpdateByIdMockHandler(),
  getKhovtTransThanhKhoanControllerFindByIdMockHandler(),
  getKhovtTransThanhKhoanControllerDeleteByIdMockHandler(),
  getKhovtTransThanhKhoanControllerCreateMockHandler(),
  getKhovtTransThanhKhoanControllerFindMockHandler(),
];
