import { type Result, type SiteId } from '../../../../core/src/index';
import { type SiteCommandOf } from '../../../../site-commands/src/index';
import type { ManagementClient } from '../../client/management/types';
import type { LocalContent } from '../content/reader';
import type { EnvTarget } from '../helpers';
import type { BlockFieldExtensionsMap } from '../../config/types';
import type { ContentDiff } from '../sync/diff';
import type { SyncResult } from '../sync';
import { type CliBlockIdentifier, type CliPageIdentifier } from './commandKeys';
import { type CliCommandCompileBatchSuccessWithReports, type CliCommandExecutionError, type CliCommandExecutionReport, type CliCommandExecutionResult, type CliCommandValidationCompileError } from './commandRuntime';
export type CliPageCommandBatchSource = 'push_pages';
export type CliPageCommandCompileError = Readonly<{
    code: 'missing_local_page';
    identifier: CliPageIdentifier;
    message: string;
}> | Readonly<{
    code: 'missing_local_block';
    identifier: `${CliPageIdentifier}/${CliBlockIdentifier}`;
    message: string;
}> | Readonly<{
    code: 'invalid_page_block';
    identifier: `${CliPageIdentifier}/${CliBlockIdentifier}`;
    warnings: readonly string[];
    message: string;
}> | CliCommandValidationCompileError;
export type CliPageCommandCompileInput = Readonly<{
    source: CliPageCommandBatchSource;
    siteId: SiteId;
    targetEnv: EnvTarget;
    diff: Pick<ContentDiff, 'pages'>;
    local: Pick<LocalContent, 'pages'>;
    blockFieldExtensions?: BlockFieldExtensionsMap;
}>;
export type CliPageCommandCompileSuccess = CliCommandCompileBatchSuccessWithReports<PageSiteCommandType, PageCommandReportSubject> & Readonly<{
    warnings: readonly string[];
}>;
export type PageSiteCommandType = 'upsertPage' | 'upsertPageBlock' | 'deletePageBlock' | 'reorderPageBlocks' | 'publishPage' | 'unpublishPage';
export type PageSiteCommand = SiteCommandOf<PageSiteCommandType>;
export type PageSiteCommandPlan = CliPageCommandCompileSuccess['plan'];
export type CliPageCommandExecutionError = CliCommandExecutionError<PageSiteCommandType>;
export type CliPageCommandExecutionResult = CliCommandExecutionResult<PageSiteCommandType>;
export declare const pageSiteCommandTypes: readonly ["upsertPage", "upsertPageBlock", "deletePageBlock", "reorderPageBlocks", "publishPage", "unpublishPage"];
export type PageCommandSyncCounter = 'created' | 'updated' | 'published' | 'unpublished';
export type BlockCommandSyncCounter = 'created' | 'updated' | 'deleted' | 'reordered';
export type PageCommandReportSubject = Readonly<{
    resource: 'page';
    identifier: CliPageIdentifier;
    counter: PageCommandSyncCounter;
}> | Readonly<{
    resource: 'block';
    pageIdentifier: CliPageIdentifier;
    identifier: CliBlockIdentifier | CliPageIdentifier;
    counter: BlockCommandSyncCounter;
}>;
export type PageCommandExecutionReport = CliCommandExecutionReport<PageCommandReportSubject>;
type PageCommandCompiledPlan = Pick<CliPageCommandCompileSuccess, 'plan' | 'reportedCommands' | 'warnings'>;
export declare function compilePagePushCommands(input: CliPageCommandCompileInput): Result<CliPageCommandCompileSuccess, CliPageCommandCompileError>;
export type PageCommandRoutingDecision = Readonly<{
    kind: 'no_page_changes';
}> | Readonly<{
    kind: 'command_backed';
}>;
export declare function pageCommandRouting(diff: Pick<ContentDiff, 'pages'>): PageCommandRoutingDecision;
export declare function executePageCommandPlan(input: Readonly<{
    client: Pick<ManagementClient, 'pages' | 'blocks'>;
    plan: Pick<PageSiteCommandPlan, 'commands'>;
}>): Promise<CliPageCommandExecutionResult>;
export declare function executePageCommandPlanAsReport(input: Readonly<{
    client: Pick<ManagementClient, 'pages' | 'blocks'>;
    compiledPlan: PageCommandCompiledPlan;
    onBeforeExecute?: (commandCount: number) => void;
}>): Promise<PageCommandExecutionReport>;
export declare function pageCommandCompileErrorToReport(error: CliPageCommandCompileError): PageCommandExecutionReport;
export declare function pageCommandExecutionToReport(input: Readonly<{
    execution: CliPageCommandExecutionResult;
    compiledPlan: PageCommandCompiledPlan;
}>): PageCommandExecutionReport;
export declare function pageCommandReportToSyncResult(report: PageCommandExecutionReport): SyncResult;
export {};
