import type { PlateCondition, PlateMapEditorState, } from '../types' import { SAMPLE_COLOR_SCALE } from '../utils/color' import { toPlateMapEditorState } from './plateMapAdapters' import { getTemplateData } from './templateEnvelopes' import { validateDoseResponseData } from './templateValidators' import type { DoseConditionsAdapterResult, DoseResponseTemplate, DoseResponseTemplateData, } from './types' /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toDoseConditions( template: DoseResponseTemplate | DoseResponseTemplateData ): DoseConditionsAdapterResult { const data = getTemplateData(template, 'dose-response') validateDoseResponseData(data) return data.compounds.map((compound, index): PlateCondition => ({ label: compound.name, color: String(compound.metadata?.color ?? SAMPLE_COLOR_SCALE[index % SAMPLE_COLOR_SCALE.length]), concentrations: compound.concentrations, unit: data.unit, })) } /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toDoseLayoutState( template: DoseResponseTemplate | DoseResponseTemplateData ): PlateMapEditorState | undefined { const data = getTemplateData(template, 'dose-response') validateDoseResponseData(data) return data.layout ? toPlateMapEditorState(data.layout) : undefined }