import request from '@/utils/http' export type SampleCodeCorrectionSource = 'cell_storage' | 'research_donation' export interface SampleCodeCorrectionImpact { table: string label: string count: number } export interface SampleCodeCorrectionPreview { ok: boolean blockers: string[] receptionSource: SampleCodeCorrectionSource oldSampleCode: string newSampleCode: string sampleId?: string | null impacts: SampleCodeCorrectionImpact[] totalAffectedRows: number hints?: { sameProductCodeAsOld?: number sameProductCodeAsNew?: number labStorageCodeUnchanged?: boolean cellProductCodeNotAutoUpdated?: boolean } } export interface SampleCodeCorrectionApplyResult { ok: boolean logId: string receptionSource: SampleCodeCorrectionSource oldSampleCode: string newSampleCode: string impactCounts: Record totalAffectedRows: number hints?: SampleCodeCorrectionPreview['hints'] } export function fetchPreviewSampleCodeCorrection(data: { receptionSource: SampleCodeCorrectionSource oldSampleCode: string newSampleCode: string newSampleCodeId?: string | null reason?: string }) { return request.post({ url: '/web/admin/sample-code-corrections/preview', data }) } export function fetchApplySampleCodeCorrection(data: { receptionSource: SampleCodeCorrectionSource oldSampleCode: string newSampleCode: string newSampleCodeId?: string | null reason?: string }) { return request.post({ url: '/web/admin/sample-code-corrections/apply', data }) }