import * as i0 from '@angular/core';
import { InjectionToken, Type } from '@angular/core';

interface RuntimeActionTranslatable {
    display?: string;
    en?: string;
    ar?: string;
}
type RuntimeActionAfterSuccess = 'refresh' | 'close';
interface RuntimeActionReason {
    source?: string;
    code?: string;
    message?: string;
    blocking?: boolean;
    details?: string | null;
    ruleKey?: string | null;
    requestId?: number | null;
    requestStatus?: string | null;
    requestSchemaId?: number | null;
    relatedRequestIds?: number[];
}
interface RuntimeAction {
    actionKey: string;
    actionName?: RuntimeActionTranslatable | string | null;
    httpMethod?: string | null;
    url?: string | null;
    isAvailable?: boolean;
    afterSuccess?: RuntimeActionAfterSuccess | null;
    stepIds?: Array<number | string>;
    needConfirmation?: boolean;
    payloadKeys?: string[];
    requiredPayloadKeys?: string[];
    payloadTemplate?: Record<string, unknown> | null;
    formId?: string | number | null;
    targetType?: string;
    targetId?: number;
    moduleKey?: string;
    operationKey?: string;
    primaryReasonCode?: string | null;
    reasons?: RuntimeActionReason[];
}
type RuntimeActionStatus = 'success' | 'error' | 'cancelled';
interface RuntimeActionResult {
    status: RuntimeActionStatus;
    actionKey: string;
    afterSuccess: RuntimeActionAfterSuccess | null;
    response?: unknown;
    error?: unknown;
}
interface RuntimeActionExecuteOptions {
    externalPayloadResolvers?: Record<string, () => unknown>;
    defaultAfterSuccess?: RuntimeActionAfterSuccess;
    successMessage?: (response: unknown, action: RuntimeAction) => string;
    errorMessage?: (error: unknown, action: RuntimeAction) => string;
    transformPayload?: (payload: Record<string, unknown> | undefined, action: RuntimeAction) => Record<string, unknown> | undefined;
    silent?: boolean;
}
interface RuntimeActionFormValue {
    requestPropertyId?: number;
    propertyKey: string;
    value: unknown;
}
interface RuntimeActionFormSource {
    getSubmitValues(): RuntimeActionFormValue[] | undefined;
}
declare function resolveActionLabel(action: RuntimeAction): string;

declare function buildActionPayload(action: RuntimeAction, formValue: Record<string, unknown> | undefined, externalResolvers?: Record<string, () => unknown>): Record<string, unknown> | undefined;
declare function normalizePayloadValue(key: string, value: unknown): unknown;
declare function resolveDefaultPayloadValue(key: string): unknown;
declare function getMissingRequiredPayloadKeys(action: RuntimeAction, payload: Record<string, unknown> | undefined): string[];
declare function isMissingPayloadValue(value: unknown): boolean;
declare function normalizeHttpMethod(value: string | null | undefined): string | null;
declare function methodSupportsBody(method: string): boolean;
declare function buildRequestOptions(method: string, payload: Record<string, unknown> | undefined): Record<string, unknown>;
declare function hasActionFormFields(action: RuntimeAction): boolean;
declare function hasProgressTemplateField(action: RuntimeAction): boolean;

declare class RuntimeActionContextStore {
    private readonly formSource;
    setFormSource(source: RuntimeActionFormSource | null): void;
    resolveFormValues(): RuntimeActionFormValue[];
    static ɵfac: i0.ɵɵFactoryDeclaration<RuntimeActionContextStore, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<RuntimeActionContextStore>;
}

declare const RUNTIME_ACTION_CONFIRM_DIALOG: InjectionToken<Type<unknown>>;
declare class RuntimeActionRunner {
    private readonly http;
    private readonly confirmation;
    private readonly modal;
    private readonly toast;
    private readonly transloco;
    private readonly confirmDialogClass;
    execute(action: RuntimeAction, options?: RuntimeActionExecuteOptions): Promise<RuntimeActionResult>;
    private runWithFormDialog;
    private confirmPlain;
    private run;
    private notExecutableMessage;
    static ɵfac: i0.ɵɵFactoryDeclaration<RuntimeActionRunner, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<RuntimeActionRunner>;
}

export { RUNTIME_ACTION_CONFIRM_DIALOG, RuntimeActionContextStore, RuntimeActionRunner, buildActionPayload, buildRequestOptions, getMissingRequiredPayloadKeys, hasActionFormFields, hasProgressTemplateField, isMissingPayloadValue, methodSupportsBody, normalizeHttpMethod, normalizePayloadValue, resolveActionLabel, resolveDefaultPayloadValue };
export type { RuntimeAction, RuntimeActionAfterSuccess, RuntimeActionExecuteOptions, RuntimeActionFormSource, RuntimeActionFormValue, RuntimeActionReason, RuntimeActionResult, RuntimeActionStatus, RuntimeActionTranslatable };
