import { R as Result } from './types-Cgumy1N4.js';

/**
 * Shared option types for all DCMTK tool wrappers.
 *
 * @module _toolTypes
 * @internal
 */
/**
 * Base options shared by all tool wrapper functions.
 * Provides configurable timeout and abort support per Rule 4.2.
 */
interface ToolBaseOptions {
    /** Timeout in milliseconds. Defaults to DEFAULT_TIMEOUT_MS. */
    readonly timeoutMs?: number | undefined;
    /** AbortSignal for external cancellation. */
    readonly signal?: AbortSignal | undefined;
}

/**
 * Converts dcm2xml "Native DICOM Model" XML into the DICOM JSON Model (PS3.18 F.2).
 *
 * dcm2xml outputs XML in the DCMTK native format:
 * ```xml
 * <NativeDicomModel>
 *   <DicomAttribute tag="00100010" vr="PN" keyword="PatientName">
 *     <PersonName number="1">
 *       <Alphabetic><FamilyName>Smith</FamilyName></Alphabetic>
 *     </PersonName>
 *   </DicomAttribute>
 *   <DicomAttribute tag="00100020" vr="LO" keyword="PatientID">
 *     <Value number="1">12345</Value>
 *   </DicomAttribute>
 * </NativeDicomModel>
 * ```
 *
 * The DICOM JSON Model output:
 * ```json
 * {
 *   "00100010": { "vr": "PN", "Value": [{"Alphabetic": "Smith"}] },
 *   "00100020": { "vr": "LO", "Value": ["12345"] }
 * }
 * ```
 *
 * @module _xmlToJson
 * @internal
 */

/** DICOM JSON Model element. */
interface DicomJsonElement {
    readonly vr: string;
    readonly Value?: ReadonlyArray<unknown>;
    readonly InlineBinary?: string;
    readonly BulkDataURI?: string;
}
/** DICOM JSON Model top-level object. */
type DicomJsonModel = Record<string, DicomJsonElement>;
/**
 * Converts dcm2xml XML output to DICOM JSON Model.
 *
 * @param xml - The XML string from dcm2xml
 * @returns A Result containing the DICOM JSON Model or an error
 */
declare function xmlToJson(xml: string): Result<DicomJsonModel>;

/**
 * Modify DICOM tags using the dcmodify binary.
 *
 * Uses spawnCommand instead of execCommand because user-supplied DICOM values
 * could contain shell metacharacters. Spawn passes args as an array with no
 * shell interpolation (Rule 7.4).
 *
 * @module dcmodify
 */

/** A single tag modification. */
interface TagModification {
    /** DICOM tag to modify, e.g. "(0010,0010)". */
    readonly tag: string;
    /** New value for the tag. */
    readonly value: string;
}
/** Options for {@link dcmodify}. */
interface DcmodifyOptions extends ToolBaseOptions {
    /** Tag modifications to apply. */
    readonly modifications?: readonly TagModification[] | undefined;
    /** Tag paths to erase (passed as `-e path`). */
    readonly erasures?: readonly string[] | undefined;
    /** Erase all private tags (uses `-ep` flag). */
    readonly erasePrivateTags?: boolean | undefined;
    /** Do not create backup (.bak) file. Defaults to true. */
    readonly noBackup?: boolean | undefined;
    /** Insert tag if it doesn't exist (uses -i flag). Defaults to false. */
    readonly insertIfMissing?: boolean | undefined;
    /** Treat 'tag not found' as success when erasing (uses -imt flag). Defaults to false. */
    readonly ignoreMissingTags?: boolean | undefined;
}
/** Result of a successful dcmodify operation. */
interface DcmodifyResult {
    /** Path to the modified DICOM file. */
    readonly filePath: string;
}
/**
 * Modifies DICOM tags in a file using the dcmodify binary.
 *
 * Uses spawn (not exec) for safety with user-supplied values.
 *
 * @param inputPath - Path to the DICOM file to modify (modified in-place)
 * @param options - Modification options
 * @returns A Result containing the file path or an error
 *
 * @example
 * ```ts
 * const result = await dcmodify('/path/to/study.dcm', {
 *     modifications: [
 *         { tag: '(0010,0010)', value: 'Anonymous' },
 *         { tag: '(0010,0020)', value: 'ANON001' },
 *     ],
 * });
 * ```
 */
declare function dcmodify(inputPath: string, options: DcmodifyOptions): Promise<Result<DcmodifyResult>>;

export { type DicomJsonElement as D, type TagModification as T, type DcmodifyOptions as a, type DcmodifyResult as b, type DicomJsonModel as c, type ToolBaseOptions as d, dcmodify as e, xmlToJson as x };
