import { ApiClient } from '../api-client';
export interface AppSummary {
    id: string;
    name: string;
    slug: string;
    status: string;
    replicas: number;
    kind: string;
    exposure: string;
    lastDeployedAt?: string;
    clusterId: string;
}
export interface AppRuntime {
    appId: string;
    deploymentName: string;
    namespace: string;
    replicas: {
        desired?: number;
        ready?: number;
        available?: number;
        unavailable?: number;
        updated?: number;
    };
    containers: Array<{
        name: string;
        image: string;
        requests: {
            cpu?: string;
            memory?: string;
        };
        limits: {
            cpu?: string;
            memory?: string;
        };
        usage?: {
            cpu?: string;
            memory?: string;
        };
    }>;
}
export interface AppLogEntry {
    timestamp: string;
    level?: string;
    message: string;
    namespace?: string;
    app?: string;
    pod?: string;
    container?: string;
}
export interface AppLogsResponse {
    cluster_id: string;
    count: number;
    logs: AppLogEntry[];
    queried_at: string;
}
export interface CrashDiagnosis {
    id: string;
    applicationId: string;
    podName: string;
    containerName: string | null;
    category: string;
    severity: string;
    title: string;
    explanation: string;
    suggestedAction: Record<string, any>;
    resolvedAt: string | null;
    createdAt: string;
}
export interface AppMetricsResponse {
    app_id: string;
    app_name: string;
    namespace: string;
    cluster_id: string;
    queried_at: string;
    metrics: {
        cpu: {
            usage_cores: number | null;
            requests_cores: number | null;
            limits_cores: number | null;
            utilization_percent: number | null;
        };
        memory: {
            usage_bytes: number | null;
            requests_bytes: number | null;
            limits_bytes: number | null;
            utilization_percent: number | null;
        };
        network: {
            receive_bytes_rate: number | null;
            transmit_bytes_rate: number | null;
        };
        status: {
            replicas_desired: number | null;
            replicas_ready: number | null;
            replicas_unavailable: number | null;
            ready_ratio: number | null;
            up: number | null;
            restart_total: number | null;
            restart_rate_1h: number | null;
        };
        pods: Array<{
            phase: string;
            count: number;
        }>;
        replicas: Array<Record<string, unknown>>;
        health?: {
            status: string;
            message?: string;
        } | null;
    };
}
export interface AppLogsOptions {
    app?: string;
    namespace?: string;
    level?: string;
    tail?: number;
    search?: string;
}
export interface AppDetail {
    id: string;
    name: string;
    slug: string;
    status: string;
    catalogInstallId?: string;
    catalogSlug?: string;
    systemProtected?: boolean;
}
export interface UninstallResult {
    id: string;
    status: string;
}
export interface DeleteAppResult {
    operation: {
        id: string;
        status: string;
        totalSteps: number;
        operationType: string;
    };
}
export interface AppBuild {
    id: string;
    applicationId: string | null;
    provider: 'IN_CLUSTER_AGENT' | 'GITHUB_ACTIONS' | 'RAILPACK' | 'DOCKERFILE';
    status: 'PENDING' | 'CLONING' | 'ANALYZING' | 'BUILDING' | 'PUSHING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
    branch: string;
    commitSha?: string;
    imageRef?: string;
    externalRunId?: string;
    externalUrl?: string;
    logsUrl?: string;
    errorMessage?: string;
    startedAt?: string;
    completedAt?: string;
    createdAt: string;
    updatedAt: string;
}
export interface ApplicationRelease {
    applicationId: string;
    operationId: string;
    status: 'IN_PROGRESS' | 'SUCCEEDED' | 'FAILED' | 'ROLLED_BACK';
    imageRef?: string | null;
    previousImageRef?: string | null;
    buildId?: string | null;
    failureReason?: string | null;
    startedAt: string;
    completedAt?: string | null;
}
export interface AvailableVersion {
    tag: string;
    imageRef: string;
    versionId?: number;
    allTags?: string[];
    isCurrentlyDeployed: boolean;
    createdAt?: string;
    digest?: string;
    deployHint?: string;
    platforms?: string[];
    lastRelease?: ApplicationRelease | null;
    releaseCount: number;
    isLatestRelease: boolean;
}
export interface AvailableVersionsResponse {
    sourceType: string;
    currentImageRef: string | null;
    versions: AvailableVersion[];
    nextPage: number | null;
    allowedPatterns: string[] | null;
}
export declare class CliAppService {
    private readonly apiClient;
    private readonly clusterId;
    constructor(apiClient: ApiClient, clusterId: string);
    static create(clusterId: string): Promise<CliAppService>;
    listApps(): Promise<AppSummary[]>;
    getAppByName(name: string): Promise<AppSummary>;
    getRuntime(appId: string): Promise<AppRuntime>;
    getLogs(options: AppLogsOptions): Promise<AppLogsResponse>;
    scale(appId: string, replicas: number): Promise<AppRuntime>;
    restart(appId: string): Promise<void>;
    stop(appId: string): Promise<void>;
    start(appId: string): Promise<void>;
    getCrashes(appId: string): Promise<CrashDiagnosis[]>;
    getCrash(appId: string, id: string): Promise<CrashDiagnosis>;
    dismissCrash(appId: string, id: string): Promise<CrashDiagnosis>;
    getMetrics(appId: string): Promise<AppMetricsResponse>;
    getAppDetail(appId: string): Promise<AppDetail>;
    uninstall(catalogInstallId: string): Promise<UninstallResult>;
    deleteApp(appId: string): Promise<DeleteAppResult>;
    getInstallStatus(catalogInstallId: string): Promise<{
        id: string;
        status: string;
        errorMessage?: string;
    }>;
    listBuilds(appId: string): Promise<AppBuild[]>;
    getLatestBuild(appId: string): Promise<AppBuild | null>;
    getBuild(buildId: string): Promise<AppBuild>;
    refreshBuild(buildId: string): Promise<AppBuild>;
    cancelBuild(buildId: string): Promise<void>;
    deployFromBuild(appId: string, buildId: string): Promise<unknown>;
    getCurrentRelease(appId: string): Promise<ApplicationRelease | null>;
    listReleases(appId: string): Promise<ApplicationRelease[]>;
    listAvailableVersions(appId: string): Promise<AvailableVersionsResponse>;
    redeployTag(appId: string, tag: string): Promise<unknown>;
    deleteImageVersion(appId: string, versionId: number, options?: {
        force?: boolean;
    }): Promise<{
        deleted: boolean;
    }>;
    createAppSnapshot(appId: string, body?: {
        volumeName?: string;
        description?: string;
    }): Promise<SnapshotResponse>;
    listAppSnapshots(appId: string): Promise<SnapshotResponse[]>;
    deleteAppSnapshot(appId: string, snapshotId: string): Promise<{
        operationId: string;
    } | void>;
    listClusterSnapshots(): Promise<SnapshotResponse[]>;
    restoreAppSnapshot(appId: string, snapshotId: string): Promise<{
        newPvcName: string;
        sourceSnapshotId: string;
    }>;
    swapAppVolume(appId: string, volumeName: string, newClaimName: string): Promise<unknown>;
    createAppBackup(appId: string, body: {
        volumeName?: string;
        description?: string;
        destination: BackupDestinationInput;
    }): Promise<BackupResponse>;
    deleteAppBackup(appId: string, exportId: string, destination: BackupDestinationInput): Promise<void>;
}
export interface SnapshotResponse {
    exportId: string;
    sink: 'pvc-clone' | 's3-archive';
    namespace: string;
    sourcePvcName?: string;
    appId?: string;
    sizeGb?: number;
    actualBytes?: number;
    createdAt: string;
    ready: boolean;
    labels: Record<string, string>;
    provider: string;
    providerCapabilities: {
        pvcCloneSupportsCheapRetention: boolean;
        s3ArchiveSupportsCheapRetention: boolean;
        pvcClonePricePerGbMonthEur: number | null;
        s3ArchivePricePerGbMonthEur: number | null;
    };
}
export interface BackupDestinationInput {
    bucket: string;
    endpoint: string;
    region: string;
    accessKeyId: string;
    secretAccessKey: string;
    keyPrefix?: string;
}
export interface BackupResponse {
    exportId: string;
    appId: string;
    namespace: string;
    sourcePvcName: string;
    sizeGb: number;
    actualBytes?: number;
    createdAt: string;
    ready: boolean;
    destination: {
        bucket: string;
        endpoint: string;
        region: string;
        keyPrefix?: string;
    };
    provider: string;
    providerCapabilities: SnapshotResponse['providerCapabilities'];
}
