import { type MediaAssetId, type Result, type SiteScopedStoragePath, type UtcIsoDateTimeString } from '@riverbankcms/core';
import { type ActiveFileAssetValidationError, type ActiveValidatedDurableFileAsset, type FileAssetMetadata, type UploadPolicy } from './fileDomain';
import type { FileUploadFinalizationPlan } from './fileUploadFinalization';
import { type FileStoragePathError } from './fileStorage';
export type FinalizeUploadAssetPlan = Extract<FileUploadFinalizationPlan, {
    readonly tag: 'finalize-upload';
}>;
export type DurableUploadPolicy = UploadPolicy & {
    readonly finalizeMode: {
        readonly tag: 'durable-file-asset';
    };
};
export type DurableFinalizeUploadAssetPlan = Omit<FinalizeUploadAssetPlan, 'uploadSession'> & {
    readonly uploadSession: Omit<FinalizeUploadAssetPlan['uploadSession'], 'policy'> & {
        readonly policy: DurableUploadPolicy;
    };
};
export type BuildFinalizedUploadAssetInput = {
    readonly finalizationPlan: DurableFinalizeUploadAssetPlan;
    readonly assetId: MediaAssetId;
    readonly now: UtcIsoDateTimeString;
    readonly metadata?: FileAssetMetadata;
};
export type DurableUploadStoragePathError = {
    readonly tag: 'safe-download-filename-required';
} | {
    readonly tag: 'invalid-storage-path';
    readonly error: FileStoragePathError;
};
export type NonDurableFinalizeModeError = {
    readonly tag: 'non-durable-finalize-mode';
    readonly finalizeMode: UploadPolicy['finalizeMode'];
};
export type BuildFinalizedUploadAssetError = DurableUploadStoragePathError | {
    readonly tag: 'invalid-file-asset';
    readonly error: ActiveFileAssetValidationError;
};
/**
 * Narrows a successful finalization plan to the durable-asset path.
 */
export declare function toDurableFinalizeUploadAssetPlan(plan: FinalizeUploadAssetPlan): Result<DurableFinalizeUploadAssetPlan, NonDurableFinalizeModeError>;
export declare function expectedDurableUploadStoragePath(finalizationPlan: DurableFinalizeUploadAssetPlan, assetId: MediaAssetId): Result<SiteScopedStoragePath, DurableUploadStoragePathError>;
/**
 * Builds a validated active durable file asset from a policy-checked upload finalization plan.
 */
export declare function buildFinalizedUploadFileAsset(input: BuildFinalizedUploadAssetInput): Result<ActiveValidatedDurableFileAsset, BuildFinalizedUploadAssetError>;
