/**
 * App Store Manager
 * Fetches, caches, and serves app templates from the remote App Store repo.
 */
import * as plugins from '../plugins.js';
import type { Onebox } from './onebox.js';
import type { IService, IServiceDomainRoute, IServicePublicPortMapping, IServicePublishedPort, IServiceTargetPort, IServiceVolume } from '../types.js';
import type * as interfaces from '../../dist_ts_interfaces/index.js';
type IAppStoreIndex = plugins.servezoneInterfaces.appstore.IAppStoreIndex;
type IAppStoreApp = plugins.servezoneInterfaces.appstore.IAppStoreApp;
type IAppStoreAppMeta = plugins.servezoneInterfaces.appstore.IAppStoreAppMeta;
type IAppStoreVersionConfig = plugins.servezoneInterfaces.appstore.IAppStoreVersionConfig;
type IAppStoreInstallOptions = plugins.servezoneInterfaces.appstore.IAppStoreInstallRequest & {
    autoDNS?: boolean;
    volumeStorageClasses?: Record<string, string>;
};
type IUpgradeableAppStoreService = plugins.servezoneInterfaces.appstore.IUpgradeableAppStoreService;
export interface IAppStoreManagerOptions {
    source?: 'package' | 'remote';
    baseUrl?: string;
    fetch?: typeof fetch;
    resolveDockerDigests?: boolean;
}
export interface IMigrationContext {
    service: {
        name: string;
        image: string;
        envVars: Record<string, string>;
        port: number;
        targetPorts?: IServiceTargetPort[];
        domains?: IServiceDomainRoute[];
        publicPortMappings?: IServicePublicPortMapping[];
    };
    fromVersion: string;
    toVersion: string;
}
export interface IMigrationResult {
    success: boolean;
    envVars?: Record<string, string>;
    image?: string;
    imageDigest?: string;
    port?: number;
    volumes?: IServiceVolume[];
    publishedPorts?: IServicePublishedPort[];
    targetPorts?: IServiceTargetPort[];
    domains?: IServiceDomainRoute[];
    publicPortMappings?: IServicePublicPortMapping[];
    warnings: string[];
}
export interface IAppStoreUpgradeApplyOptions {
    onProgress?: (progressArg: {
        step: string;
        message: string;
    }) => void | Promise<void>;
}
export declare class AppStoreManager {
    private oneboxRef;
    private appStoreCache;
    private appStoreResolver;
    private lastFetchTime;
    private readonly appStoreSource;
    private readonly appStoreBaseUrl;
    private readonly fetchRef;
    private readonly resolveDockerDigests;
    private readonly cacheTtlMs;
    constructor(oneboxRef: Onebox, optionsArg?: IAppStoreManagerOptions);
    init(): Promise<void>;
    getAppStore(): Promise<IAppStoreIndex>;
    getApps(): Promise<IAppStoreApp[]>;
    getSourceInfo(): interfaces.requests.IAppStoreSourceInfo;
    getAppMeta(appIdArg: string): Promise<IAppStoreAppMeta>;
    getAppVersionConfig(appIdArg: string, versionArg?: string): Promise<IAppStoreVersionConfig>;
    installApp(optionsArg: IAppStoreInstallOptions): Promise<IService>;
    getUpgradeableAppStoreServices(): Promise<IUpgradeableAppStoreService[]>;
    hasMigrationScript(appIdArg: string, fromVersionArg: string, toVersionArg: string): Promise<boolean>;
    executeMigration(serviceArg: IService, fromVersionArg: string, toVersionArg: string): Promise<IMigrationResult>;
    applyUpgrade(serviceNameArg: string, migrationResultArg: IMigrationResult, newVersionArg: string, optionsArg?: IAppStoreUpgradeApplyOptions): Promise<IService>;
    normalizeVolumes(volumesArg?: IAppStoreVersionConfig['volumes']): IServiceVolume[];
    validateAppVersionConfig(configArg: IAppStoreVersionConfig, labelArg?: string): void;
    private createAppStoreResolver;
    private fetchText;
    private validateInstallOptions;
    private assertValidPort;
    private getAppStoreWebPort;
    private getAppStoreTargetPorts;
    private getInstallDomains;
    private getDefaultInstallDomainTarget;
    private replaceServiceDomainTemplate;
    private getAppStoreInputs;
    private generateAppStoreSecret;
    private requiresTemplateValue;
    private applyServiceDomainEnv;
    private assertRuntimeCompatibility;
    private compareVersions;
}
export {};
