// Data-import DOMAIN — the image data types a user imports, and which pipeline carries them.
// Pure: no React, no axios, no @ump/shared. See docs/workflows/data-import-spec.md §3 (the
// Direct Upload type picker), §5 (the per-type mapping table), and items-list-spec.md §2.3
// (the per-type Items List shape). Rule IDs (D*/C*/MAP*) below trace back to that spec.

/** The two ingestion pipelines. Direct = files hosted on our servers; Cloud = referenced. */
export type Pipeline = 'direct' | 'cloud';

/**
 * The single image data type chosen for one import job (D1 — exactly one type per upload).
 * These are the §3 "SelectingType" options. NRRD/MHA/MHD are supported *formats* (§2.1) but
 * not distinct picker types in v1 — see formats.ts and the open questions in the spec (§9.1).
 */
export type DataType = 'dicom' | 'nifti' | 'image2d' | 'video' | 'videoFrames';

export const DATA_TYPES: readonly DataType[] = ['dicom', 'nifti', 'image2d', 'video', 'videoFrames'];

/** Vietnamese picker labels (domain UI is Vietnamese — preserve diacritics). */
export const DATA_TYPE_LABELS_VI: Record<DataType, string> = {
  dicom: 'DICOM (chuỗi ảnh)',
  nifti: 'NIfTI (thể tích)',
  image2d: 'Ảnh 2D',
  video: 'Video',
  videoFrames: 'Khung hình video',
};

/**
 * D2 / MAP3 — "Group by Study" is offered ONLY for DICOM & NIfTI volume data. Offering it for
 * 2D images or video is invalid; the reducer/guards must refuse to set groupByStudy otherwise.
 */
export function supportsGroupByStudy(dataType: DataType): boolean {
  return dataType === 'dicom' || dataType === 'nifti';
}

/** Whether a data type is a 3D volume (DICOM series or NIfTI) vs a flat 2D/video asset. */
export function isVolumeType(dataType: DataType): boolean {
  return dataType === 'dicom' || dataType === 'nifti';
}
