/** * Generated by orval v8.19.0 🍺 * Do not edit manually. * Webitel API * OpenAPI spec version: 24.04.0 */ import { faker } from '@faker-js/faker'; import type { RequestHandlerOptions } from 'msw'; import { HttpResponse, http } from 'msw'; import type { WfmCreateForecastCalculationResponse, WfmDeleteForecastCalculationResponse, WfmExecuteForecastCalculationResponse, WfmReadForecastCalculationResponse, WfmSearchForecastCalculationResponse, WfmUpdateForecastCalculationResponse, } from '../_models'; export const getForecastCalculationServiceSearchForecastCalculationResponseMock = ( overrideResponse: Partial< Extract > = {}, ): WfmSearchForecastCalculationResponse => ({ items: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => ({ args: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => faker.string.alpha({ length: { min: 10, max: 20, }, }), ), undefined, ]), createdAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), createdBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), description: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), domainId: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), procedure: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), updatedAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), updatedBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), })), undefined, ]), next: faker.helpers.arrayElement([ faker.datatype.boolean(), undefined, ]), ...overrideResponse, }); export const getForecastCalculationServiceCreateForecastCalculationResponseMock = ( overrideResponse: Partial< Extract > = {}, ): WfmCreateForecastCalculationResponse => ({ item: faker.helpers.arrayElement([ { args: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => faker.string.alpha({ length: { min: 10, max: 20, }, }), ), undefined, ]), createdAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), createdBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), description: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), domainId: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), procedure: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), updatedAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), updatedBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), }, undefined, ]), ...overrideResponse, }); export const getForecastCalculationServiceDeleteForecastCalculationResponseMock = ( overrideResponse: Partial< Extract > = {}, ): WfmDeleteForecastCalculationResponse => ({ id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), ...overrideResponse, }); export const getForecastCalculationServiceReadForecastCalculationResponseMock = ( overrideResponse: Partial< Extract > = {}, ): WfmReadForecastCalculationResponse => ({ item: faker.helpers.arrayElement([ { args: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => faker.string.alpha({ length: { min: 10, max: 20, }, }), ), undefined, ]), createdAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), createdBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), description: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), domainId: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), procedure: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), updatedAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), updatedBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), }, undefined, ]), ...overrideResponse, }); export const getForecastCalculationServiceExecuteForecastCalculationResponseMock = ( overrideResponse: Partial< Extract > = {}, ): WfmExecuteForecastCalculationResponse => ({ items: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => ({ agents: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), timestamp: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), })), undefined, ]), ...overrideResponse, }); export const getForecastCalculationServiceUpdateForecastCalculationResponseMock = ( overrideResponse: Partial< Extract > = {}, ): WfmUpdateForecastCalculationResponse => ({ item: faker.helpers.arrayElement([ { args: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => faker.string.alpha({ length: { min: 10, max: 20, }, }), ), undefined, ]), createdAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), createdBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), description: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), domainId: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), procedure: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), updatedAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), updatedBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), }, undefined, ]), ...overrideResponse, }); export const getForecastCalculationServiceSearchForecastCalculationMockHandler = ( overrideResponse?: | WfmSearchForecastCalculationResponse | (( info: Parameters[1]>[0], ) => | Promise | WfmSearchForecastCalculationResponse), options?: RequestHandlerOptions, ) => { return http.get( '*/wfm/lookups/forecast_calculation', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getForecastCalculationServiceSearchForecastCalculationResponseMock(), { status: 200, }, ); }, options, ); }; export const getForecastCalculationServiceCreateForecastCalculationMockHandler = ( overrideResponse?: | WfmCreateForecastCalculationResponse | (( info: Parameters[1]>[0], ) => | Promise | WfmCreateForecastCalculationResponse), options?: RequestHandlerOptions, ) => { return http.post( '*/wfm/lookups/forecast_calculation', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getForecastCalculationServiceCreateForecastCalculationResponseMock(), { status: 200, }, ); }, options, ); }; export const getForecastCalculationServiceDeleteForecastCalculationMockHandler = ( overrideResponse?: | WfmDeleteForecastCalculationResponse | (( info: Parameters[1]>[0], ) => | Promise | WfmDeleteForecastCalculationResponse), options?: RequestHandlerOptions, ) => { return http.delete( '*/wfm/lookups/forecast_calculation/:id', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getForecastCalculationServiceDeleteForecastCalculationResponseMock(), { status: 200, }, ); }, options, ); }; export const getForecastCalculationServiceReadForecastCalculationMockHandler = ( overrideResponse?: | WfmReadForecastCalculationResponse | (( info: Parameters[1]>[0], ) => | Promise | WfmReadForecastCalculationResponse), options?: RequestHandlerOptions, ) => { return http.get( '*/wfm/lookups/forecast_calculation/:id', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getForecastCalculationServiceReadForecastCalculationResponseMock(), { status: 200, }, ); }, options, ); }; export const getForecastCalculationServiceExecuteForecastCalculationMockHandler = ( overrideResponse?: | WfmExecuteForecastCalculationResponse | (( info: Parameters[1]>[0], ) => | Promise | WfmExecuteForecastCalculationResponse), options?: RequestHandlerOptions, ) => { return http.get( '*/wfm/lookups/forecast_calculation/:id/execute', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getForecastCalculationServiceExecuteForecastCalculationResponseMock(), { status: 200, }, ); }, options, ); }; export const getForecastCalculationServiceUpdateForecastCalculationMockHandler = ( overrideResponse?: | WfmUpdateForecastCalculationResponse | (( info: Parameters[1]>[0], ) => | Promise | WfmUpdateForecastCalculationResponse), options?: RequestHandlerOptions, ) => { return http.put( '*/wfm/lookups/forecast_calculation/item.id}', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getForecastCalculationServiceUpdateForecastCalculationResponseMock(), { status: 200, }, ); }, options, ); }; export const getForecastCalculationServiceMock = () => [ getForecastCalculationServiceSearchForecastCalculationMockHandler(), getForecastCalculationServiceCreateForecastCalculationMockHandler(), getForecastCalculationServiceDeleteForecastCalculationMockHandler(), getForecastCalculationServiceReadForecastCalculationMockHandler(), getForecastCalculationServiceExecuteForecastCalculationMockHandler(), getForecastCalculationServiceUpdateForecastCalculationMockHandler(), ];