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

export const getKhovtTransPhieuXuatControllerCreateResponseMock = (
  overrideResponse: Partial<KhovtTransPhieuXuatWithRelations> = {},
): KhovtTransPhieuXuatWithRelations => ({
  details: faker.helpers.arrayElement([
    Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
      foreignKey: faker.helpers.arrayElement([{}, undefined]),
      id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
      maLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      nguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      phieuXuat: faker.helpers.arrayElement([
        {
          details: faker.helpers.arrayElement([[], 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]),
          khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          ngayXuat: faker.helpers.arrayElement([
            faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
            undefined,
          ]),
          nguoiTaoPhieu: faker.helpers.arrayElement([
            faker.helpers.arrayElement([faker.word.sample(), null]),
            undefined,
          ]),
          soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          thongTinCanhBao: faker.helpers.arrayElement([
            faker.helpers.arrayElement([faker.word.sample(), null]),
            undefined,
          ]),
        },
        undefined,
      ]),
      phieuXuatId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
      soLuongThucTe: faker.helpers.arrayElement([
        faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
        undefined,
      ]),
      soLuongYeuCau: faker.helpers.arrayElement([
        faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
        undefined,
      ]),
      tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      tonKho: faker.helpers.arrayElement([
        faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
        undefined,
      ]),
    })),
    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]),
  khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  ngayXuat: faker.helpers.arrayElement([
    faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
    undefined,
  ]),
  nguoiTaoPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  thongTinCanhBao: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  ...overrideResponse,
});

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

export const getKhovtTransPhieuXuatControllerUpdateByIdResponseMock = (
  overrideResponse: Partial<KhovtTransPhieuXuatWithRelations> = {},
): KhovtTransPhieuXuatWithRelations => ({
  details: faker.helpers.arrayElement([
    Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
      foreignKey: faker.helpers.arrayElement([{}, undefined]),
      id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
      maLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      nguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      phieuXuat: faker.helpers.arrayElement([
        {
          details: faker.helpers.arrayElement([[], 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]),
          khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          ngayXuat: faker.helpers.arrayElement([
            faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
            undefined,
          ]),
          nguoiTaoPhieu: faker.helpers.arrayElement([
            faker.helpers.arrayElement([faker.word.sample(), null]),
            undefined,
          ]),
          soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          thongTinCanhBao: faker.helpers.arrayElement([
            faker.helpers.arrayElement([faker.word.sample(), null]),
            undefined,
          ]),
        },
        undefined,
      ]),
      phieuXuatId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
      soLuongThucTe: faker.helpers.arrayElement([
        faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
        undefined,
      ]),
      soLuongYeuCau: faker.helpers.arrayElement([
        faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
        undefined,
      ]),
      tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      tonKho: faker.helpers.arrayElement([
        faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
        undefined,
      ]),
    })),
    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]),
  khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  ngayXuat: faker.helpers.arrayElement([
    faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
    undefined,
  ]),
  nguoiTaoPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  thongTinCanhBao: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  ...overrideResponse,
});

export const getKhovtTransPhieuXuatControllerFindByIdResponseMock = (
  overrideResponse: Partial<KhovtTransPhieuXuatWithRelations> = {},
): KhovtTransPhieuXuatWithRelations => ({
  details: faker.helpers.arrayElement([
    Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
      foreignKey: faker.helpers.arrayElement([{}, undefined]),
      id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
      maLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      nguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      phieuXuat: faker.helpers.arrayElement([
        {
          details: faker.helpers.arrayElement([[], 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]),
          khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          ngayXuat: faker.helpers.arrayElement([
            faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
            undefined,
          ]),
          nguoiTaoPhieu: faker.helpers.arrayElement([
            faker.helpers.arrayElement([faker.word.sample(), null]),
            undefined,
          ]),
          soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
          thongTinCanhBao: faker.helpers.arrayElement([
            faker.helpers.arrayElement([faker.word.sample(), null]),
            undefined,
          ]),
        },
        undefined,
      ]),
      phieuXuatId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
      soLuongThucTe: faker.helpers.arrayElement([
        faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
        undefined,
      ]),
      soLuongYeuCau: faker.helpers.arrayElement([
        faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
        undefined,
      ]),
      tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
      tonKho: faker.helpers.arrayElement([
        faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
        undefined,
      ]),
    })),
    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]),
  khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  ngayXuat: faker.helpers.arrayElement([
    faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
    undefined,
  ]),
  nguoiTaoPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  thongTinCanhBao: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  ...overrideResponse,
});

export const getKhovtTransPhieuXuatControllerFindResponseMock = (): KhovtTransPhieuXuatWithRelations[] =>
  Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
    details: faker.helpers.arrayElement([
      Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
        foreignKey: faker.helpers.arrayElement([{}, undefined]),
        id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
        maLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
        maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
        nguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
        phieuXuatId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
        soLuongThucTe: faker.helpers.arrayElement([
          faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
          undefined,
        ]),
        soLuongYeuCau: faker.helpers.arrayElement([
          faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
          undefined,
        ]),
        tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
        tonKho: faker.helpers.arrayElement([
          faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
          undefined,
        ]),
      })),
      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]),
    khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    ngayXuat: faker.helpers.arrayElement([
      faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
      undefined,
    ]),
    nguoiTaoPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
    thongTinCanhBao: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
  }));

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

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

export const getKhovtTransPhieuXuatControllerUpdateByIdMockHandler = (
  overrideResponse?:
    | KhovtTransPhieuXuatWithRelations
    | ((
        info: Parameters<Parameters<typeof http.patch>[1]>[0],
      ) => Promise<KhovtTransPhieuXuatWithRelations> | KhovtTransPhieuXuatWithRelations),
) => {
  return http.patch('*/khovt-trans-phieu-xuats/:id', async (info) => {
    await delay(1000);
    return new HttpResponse(
      JSON.stringify(
        overrideResponse !== undefined
          ? typeof overrideResponse === 'function'
            ? await overrideResponse(info)
            : overrideResponse
          : getKhovtTransPhieuXuatControllerUpdateByIdResponseMock(),
      ),
      {
        status: 204,
        headers: {
          'Content-Type': 'application/json',
        },
      },
    );
  });
};

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

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

export const getKhovtTransPhieuXuatControllerFindMockHandler = (
  overrideResponse?:
    | KhovtTransPhieuXuatWithRelations[]
    | ((
        info: Parameters<Parameters<typeof http.get>[1]>[0],
      ) => Promise<KhovtTransPhieuXuatWithRelations[]> | KhovtTransPhieuXuatWithRelations[]),
) => {
  return http.get('*/khovt-trans-phieu-xuats', async (info) => {
    await delay(1000);
    return new HttpResponse(
      JSON.stringify(
        overrideResponse !== undefined
          ? typeof overrideResponse === 'function'
            ? await overrideResponse(info)
            : overrideResponse
          : getKhovtTransPhieuXuatControllerFindResponseMock(),
      ),
      {
        status: 200,
        headers: {
          'Content-Type': 'application/json',
        },
      },
    );
  });
};
export const getKhovtTransPhieuXuatControllerMock = () => [
  getKhovtTransPhieuXuatControllerCreateMockHandler(),
  getKhovtTransPhieuXuatControllerCountMockHandler(),
  getKhovtTransPhieuXuatControllerUpdateByIdMockHandler(),
  getKhovtTransPhieuXuatControllerFindByIdMockHandler(),
  getKhovtTransPhieuXuatControllerDeleteByIdMockHandler(),
  getKhovtTransPhieuXuatControllerFindMockHandler(),
];
