/** * Generated by orval 🍺 * Do not edit manually. * Lincodex API * OpenAPI spec version: 0.1.0 */ import { faker } from '@faker-js/faker'; import { fakeFromPattern } from '../../mock-pattern'; import { HttpResponse, http } from 'msw'; import type { RequestHandlerOptions } from 'msw'; import type { SupportCase, SupportCaseAssessmentTarget, SupportCaseDecision, SupportCaseList, SupportCaseObjectReference } from '../../schemas'; export const getListMySupportCasesResponseSupportCaseObjectReferenceMock = (overrideResponse: Partial = {}): SupportCaseObjectReference => ({...{type: faker.helpers.arrayElement(['assessment_attempt','organization','invitation','support_case'] as const), id: faker.string.uuid()}, ...overrideResponse}); export const getListMySupportCasesResponseSupportCaseAssessmentTargetMock = (overrideResponse: Partial = {}): SupportCaseAssessmentTarget => ({...{specialization: faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const), grade: faker.helpers.arrayElement(['intern','junior','middle','senior'] as const)}, ...overrideResponse}); export const getListMySupportCasesResponseMock = (overrideResponse: Partial> = {}): SupportCaseList => ({items: Array.from({ length: faker.number.int({min: 1, max: 100}) }, (_, i) => i + 1).map(() => ({id: faker.string.uuid(), number: fakeFromPattern("^SC-[0-9]{4}-[0-9]{6,10}$", {minLength: 14, maxLength: 18}), type: faker.helpers.arrayElement(['support','complaint','grade_appeal','anticheat_appeal','manual_assessment'] as const), status: faker.helpers.arrayElement(['submitted','in_review','waiting_for_user','waiting_expert','resolved','closed'] as const), object: faker.helpers.arrayElement([{...getListMySupportCasesResponseSupportCaseObjectReferenceMock()},null,]), assessment_target: faker.helpers.arrayElement([{...getListMySupportCasesResponseSupportCaseAssessmentTargetMock()},null,]), response_target: {kind: faker.helpers.arrayElement(['operational_goal'] as const), business_days: faker.number.int({min: 1, max: 60}), due_at: faker.date.past().toISOString().slice(0, 19) + 'Z', answered_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), late: faker.datatype.boolean(), policy_version: faker.number.int({min: 1})}, decision_outcome: faker.helpers.arrayElement([faker.helpers.arrayElement(['upheld','partially_upheld','not_upheld','answered','assessed'] as const),null,]), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', updated_at: faker.date.past().toISOString().slice(0, 19) + 'Z'})), page: {has_more: faker.datatype.boolean(), next_cursor: faker.helpers.arrayElement([fakeFromPattern("^[A-Za-z0-9_-]+$", {minLength: 1, maxLength: 512}), null])}, ...overrideResponse}) export const getCreateMySupportCaseResponseSupportCaseObjectReferenceMock = (overrideResponse: Partial = {}): SupportCaseObjectReference => ({...{type: faker.helpers.arrayElement(['assessment_attempt','organization','invitation','support_case'] as const), id: faker.string.uuid()}, ...overrideResponse}); export const getCreateMySupportCaseResponseSupportCaseAssessmentTargetMock = (overrideResponse: Partial = {}): SupportCaseAssessmentTarget => ({...{specialization: faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const), grade: faker.helpers.arrayElement(['intern','junior','middle','senior'] as const)}, ...overrideResponse}); export const getCreateMySupportCaseResponseSupportCaseDecisionMock = (overrideResponse: Partial = {}): SupportCaseDecision => ({...{outcome: faker.helpers.arrayElement(['upheld','partially_upheld','not_upheld','answered','assessed'] as const), reason: faker.string.alpha({length: {min: 1, max: 4000}}), decided_at: faker.date.past().toISOString().slice(0, 19) + 'Z'}, ...overrideResponse}); export const getCreateMySupportCaseResponseMock = (overrideResponse: Partial> = {}): SupportCase => ({id: faker.string.uuid(), number: fakeFromPattern("^SC-[0-9]{4}-[0-9]{6,10}$", {minLength: 14, maxLength: 18}), type: faker.helpers.arrayElement(['support','complaint','grade_appeal','anticheat_appeal','manual_assessment'] as const), status: faker.helpers.arrayElement(['submitted','in_review','waiting_for_user','waiting_expert','resolved','closed'] as const), description: fakeFromPattern("\\S", {minLength: 1, maxLength: 4000}), object: faker.helpers.arrayElement([{...getCreateMySupportCaseResponseSupportCaseObjectReferenceMock()},null,]), assessment_target: faker.helpers.arrayElement([{...getCreateMySupportCaseResponseSupportCaseAssessmentTargetMock()},null,]), complaint_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(['organization_conduct','offer_content','salary_terms_violation','data_disclosure','other'] as const),null,]), rubric_version: faker.helpers.arrayElement([faker.number.int({min: 1}), null]), response_target: {kind: faker.helpers.arrayElement(['operational_goal'] as const), business_days: faker.number.int({min: 1, max: 60}), due_at: faker.date.past().toISOString().slice(0, 19) + 'Z', answered_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), late: faker.datatype.boolean(), policy_version: faker.number.int({min: 1})}, decision: faker.helpers.arrayElement([{...getCreateMySupportCaseResponseSupportCaseDecisionMock()},null,]), history: Array.from({ length: faker.number.int({min: 1, max: 200}) }, (_, i) => i + 1).map(() => ({sequence: faker.number.int({min: 1}), kind: faker.helpers.arrayElement(['created','status_changed','reply','decision'] as const), actor: faker.helpers.arrayElement(['user','support','system'] as const), occurred_at: faker.date.past().toISOString().slice(0, 19) + 'Z', status: faker.helpers.arrayElement([faker.helpers.arrayElement(['submitted','in_review','waiting_for_user','waiting_expert','resolved','closed'] as const),null,]), message: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 4000}}),null,])})), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', updated_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse}) export const getGetMySupportCaseResponseSupportCaseObjectReferenceMock = (overrideResponse: Partial = {}): SupportCaseObjectReference => ({...{type: faker.helpers.arrayElement(['assessment_attempt','organization','invitation','support_case'] as const), id: faker.string.uuid()}, ...overrideResponse}); export const getGetMySupportCaseResponseSupportCaseAssessmentTargetMock = (overrideResponse: Partial = {}): SupportCaseAssessmentTarget => ({...{specialization: faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const), grade: faker.helpers.arrayElement(['intern','junior','middle','senior'] as const)}, ...overrideResponse}); export const getGetMySupportCaseResponseSupportCaseDecisionMock = (overrideResponse: Partial = {}): SupportCaseDecision => ({...{outcome: faker.helpers.arrayElement(['upheld','partially_upheld','not_upheld','answered','assessed'] as const), reason: faker.string.alpha({length: {min: 1, max: 4000}}), decided_at: faker.date.past().toISOString().slice(0, 19) + 'Z'}, ...overrideResponse}); export const getGetMySupportCaseResponseMock = (overrideResponse: Partial> = {}): SupportCase => ({id: faker.string.uuid(), number: fakeFromPattern("^SC-[0-9]{4}-[0-9]{6,10}$", {minLength: 14, maxLength: 18}), type: faker.helpers.arrayElement(['support','complaint','grade_appeal','anticheat_appeal','manual_assessment'] as const), status: faker.helpers.arrayElement(['submitted','in_review','waiting_for_user','waiting_expert','resolved','closed'] as const), description: fakeFromPattern("\\S", {minLength: 1, maxLength: 4000}), object: faker.helpers.arrayElement([{...getGetMySupportCaseResponseSupportCaseObjectReferenceMock()},null,]), assessment_target: faker.helpers.arrayElement([{...getGetMySupportCaseResponseSupportCaseAssessmentTargetMock()},null,]), complaint_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(['organization_conduct','offer_content','salary_terms_violation','data_disclosure','other'] as const),null,]), rubric_version: faker.helpers.arrayElement([faker.number.int({min: 1}), null]), response_target: {kind: faker.helpers.arrayElement(['operational_goal'] as const), business_days: faker.number.int({min: 1, max: 60}), due_at: faker.date.past().toISOString().slice(0, 19) + 'Z', answered_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), late: faker.datatype.boolean(), policy_version: faker.number.int({min: 1})}, decision: faker.helpers.arrayElement([{...getGetMySupportCaseResponseSupportCaseDecisionMock()},null,]), history: Array.from({ length: faker.number.int({min: 1, max: 200}) }, (_, i) => i + 1).map(() => ({sequence: faker.number.int({min: 1}), kind: faker.helpers.arrayElement(['created','status_changed','reply','decision'] as const), actor: faker.helpers.arrayElement(['user','support','system'] as const), occurred_at: faker.date.past().toISOString().slice(0, 19) + 'Z', status: faker.helpers.arrayElement([faker.helpers.arrayElement(['submitted','in_review','waiting_for_user','waiting_expert','resolved','closed'] as const),null,]), message: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 4000}}),null,])})), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', updated_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse}) export const getListMySupportCasesMockHandler = (overrideResponse?: SupportCaseList | ((info: Parameters[1]>[0]) => Promise | SupportCaseList), options?: RequestHandlerOptions) => { return http.get('*/api/v1/me/support-cases', async (info: Parameters[1]>[0]) => { return HttpResponse.json(overrideResponse !== undefined ? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse) : getListMySupportCasesResponseMock(), { status: 200 }) }, options) } export const getCreateMySupportCaseMockHandler = (overrideResponse?: SupportCase | ((info: Parameters[1]>[0]) => Promise | SupportCase), options?: RequestHandlerOptions) => { return http.post('*/api/v1/me/support-cases', async (info: Parameters[1]>[0]) => { return HttpResponse.json(overrideResponse !== undefined ? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse) : getCreateMySupportCaseResponseMock(), { status: 201 }) }, options) } export const getGetMySupportCaseMockHandler = (overrideResponse?: SupportCase | ((info: Parameters[1]>[0]) => Promise | SupportCase), options?: RequestHandlerOptions) => { return http.get('*/api/v1/me/support-cases/:caseId', async (info: Parameters[1]>[0]) => { return HttpResponse.json(overrideResponse !== undefined ? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse) : getGetMySupportCaseResponseMock(), { status: 200 }) }, options) } export const getSupportMock = () => [ getListMySupportCasesMockHandler(), getCreateMySupportCaseMockHandler(), getGetMySupportCaseMockHandler() ]