/** * 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 { EngineCommunicationType, EngineListCommunicationType, } from '../_models'; import { EngineCommunicationChannels } from '../_models'; export const getSearchCommunicationTypeResponseMock = ( overrideResponse: Partial> = {}, ): EngineListCommunicationType => ({ items: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(EngineCommunicationChannels)), undefined, ]), code: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), default: faker.helpers.arrayElement([ faker.datatype.boolean(), 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, ]), })), undefined, ]), next: faker.helpers.arrayElement([ faker.datatype.boolean(), undefined, ]), ...overrideResponse, }); export const getCreateCommunicationTypeResponseMock = ( overrideResponse: Partial> = {}, ): EngineCommunicationType => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(EngineCommunicationChannels)), undefined, ]), code: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), default: faker.helpers.arrayElement([ faker.datatype.boolean(), 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, ]), ...overrideResponse, }); export const getDeleteCommunicationTypeResponseMock = ( overrideResponse: Partial> = {}, ): EngineCommunicationType => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(EngineCommunicationChannels)), undefined, ]), code: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), default: faker.helpers.arrayElement([ faker.datatype.boolean(), 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, ]), ...overrideResponse, }); export const getReadCommunicationTypeResponseMock = ( overrideResponse: Partial> = {}, ): EngineCommunicationType => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(EngineCommunicationChannels)), undefined, ]), code: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), default: faker.helpers.arrayElement([ faker.datatype.boolean(), 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, ]), ...overrideResponse, }); export const getPatchCommunicationTypeResponseMock = ( overrideResponse: Partial> = {}, ): EngineCommunicationType => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(EngineCommunicationChannels)), undefined, ]), code: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), default: faker.helpers.arrayElement([ faker.datatype.boolean(), 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, ]), ...overrideResponse, }); export const getUpdateCommunicationTypeResponseMock = ( overrideResponse: Partial> = {}, ): EngineCommunicationType => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(EngineCommunicationChannels)), undefined, ]), code: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), default: faker.helpers.arrayElement([ faker.datatype.boolean(), 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, ]), ...overrideResponse, }); export const getSearchCommunicationTypeMockHandler = ( overrideResponse?: | EngineListCommunicationType | (( info: Parameters[1]>[0], ) => Promise | EngineListCommunicationType), options?: RequestHandlerOptions, ) => { return http.get( '*/call_center/communication_type', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getSearchCommunicationTypeResponseMock(), { status: 200, }, ); }, options, ); }; export const getCreateCommunicationTypeMockHandler = ( overrideResponse?: | EngineCommunicationType | (( info: Parameters[1]>[0], ) => Promise | EngineCommunicationType), options?: RequestHandlerOptions, ) => { return http.post( '*/call_center/communication_type', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getCreateCommunicationTypeResponseMock(), { status: 200, }, ); }, options, ); }; export const getDeleteCommunicationTypeMockHandler = ( overrideResponse?: | EngineCommunicationType | (( info: Parameters[1]>[0], ) => Promise | EngineCommunicationType), options?: RequestHandlerOptions, ) => { return http.delete( '*/call_center/communication_type/:id', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getDeleteCommunicationTypeResponseMock(), { status: 200, }, ); }, options, ); }; export const getReadCommunicationTypeMockHandler = ( overrideResponse?: | EngineCommunicationType | (( info: Parameters[1]>[0], ) => Promise | EngineCommunicationType), options?: RequestHandlerOptions, ) => { return http.get( '*/call_center/communication_type/:id', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getReadCommunicationTypeResponseMock(), { status: 200, }, ); }, options, ); }; export const getPatchCommunicationTypeMockHandler = ( overrideResponse?: | EngineCommunicationType | (( info: Parameters[1]>[0], ) => Promise | EngineCommunicationType), options?: RequestHandlerOptions, ) => { return http.patch( '*/call_center/communication_type/:id', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getPatchCommunicationTypeResponseMock(), { status: 200, }, ); }, options, ); }; export const getUpdateCommunicationTypeMockHandler = ( overrideResponse?: | EngineCommunicationType | (( info: Parameters[1]>[0], ) => Promise | EngineCommunicationType), options?: RequestHandlerOptions, ) => { return http.put( '*/call_center/communication_type/:id', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getUpdateCommunicationTypeResponseMock(), { status: 200, }, ); }, options, ); }; export const getCommunicationTypeServiceMock = () => [ getSearchCommunicationTypeMockHandler(), getCreateCommunicationTypeMockHandler(), getDeleteCommunicationTypeMockHandler(), getReadCommunicationTypeMockHandler(), getPatchCommunicationTypeMockHandler(), getUpdateCommunicationTypeMockHandler(), ];