import { SAMPLE_COLOR_SCALE } from '../utils/color' import { sampleIdFromName } from './builderIdUtils' import { createTemplateEnvelope } from './templateEnvelopes' import type { CreatePlateMapTemplateOptions, PlateMapTemplate, TemplateSample, } 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 createPlateMapTemplate( options: CreatePlateMapTemplateOptions = {} ): PlateMapTemplate { const { id = 'plate-1', name = 'Plate 1', format = 96, samples = [], metadata = {}, } = options const sampleDefinitions = samples.map((sample, index): TemplateSample => { if (typeof sample !== 'string') return sample return { id: sampleIdFromName(sample, index), name: sample, color: SAMPLE_COLOR_SCALE[index % SAMPLE_COLOR_SCALE.length], } }) return createTemplateEnvelope('plate-map', { plates: [ { id, name, format, wells: {}, }, ], samples: sampleDefinitions, activePlateId: id, selectedWells: [], }, metadata) }