import { CapacityCreditInfo } from "../utils/mint-cc";
import { PKPInfo } from "../utils/mint-pkp";
import { PermissionData } from "@lit-protocol/vincent-contracts-sdk";
interface AccountState {
    privateKey: string;
    address: string;
    createdAt: string;
    network: string;
}
interface PKPState extends PKPInfo {
    createdAt: string;
    network: string;
}
interface CapacityCreditState extends CapacityCreditInfo {
    network: string;
    expiresAt: string;
}
interface VincentAppState {
    appId: number;
    appVersion: number;
    createdAt: string;
    network: string;
    delegateeAddress: string;
    abilityIpfsCids: string[];
    abilityPolicies: string[][];
    policyParams: PermissionData;
}
interface PKPAppPermissionState {
    pkpEthAddress: string;
    appId: number;
    appVersion: number;
    permittedAt: string;
    network: string;
}
interface ConfigurationState {
    configHash: string;
    abilityIpfsCids: string[];
    abilityPolicyCids: string[][];
    lastUsed: string;
    network: string;
    state: {
        vincentApp?: VincentAppState;
        pkpAppPermissions?: PKPAppPermissionState[];
    };
}
interface AppVersionConfiguration {
    appId: number;
    appVersion: number;
    abilityIpfsCids: string[];
    abilityPolicyCids: string[][];
    lastUsed: string;
    network: string;
    state: {
        vincentApp: VincentAppState;
        pkpAppPermissions?: PKPAppPermissionState[];
    };
}
interface NestedE2EState {
    version: string;
    sharedAccounts?: {
        [network: string]: {
            appManager?: AccountState;
            appDelegatee?: AccountState;
            agentWalletPkpOwner?: AccountState;
        };
    };
    sharedPkps?: {
        [network: string]: PKPState;
    };
    sharedCapacityCredits?: {
        [network: string]: CapacityCreditState;
    };
    testFiles: {
        [fileName: string]: {
            accounts?: {
                [network: string]: {
                    appManager?: AccountState;
                    appDelegatee?: AccountState;
                    agentWalletPkpOwner?: AccountState;
                };
            };
            pkps?: {
                [network: string]: PKPState;
            };
            capacityCredits?: {
                [network: string]: CapacityCreditState;
            };
            configurations: {
                [configHash: string]: ConfigurationState;
            };
            appVersions: {
                [appVersionKey: string]: AppVersionConfiguration;
            };
        };
    };
}
export declare class StateManager {
    private network;
    private testFileName;
    private configHash;
    nestedState: NestedE2EState;
    private currentConfigState;
    constructor(network: string, testFileName: string, configHash: string, abilityIpfsCids?: string[], abilityPolicyCids?: string[][]);
    /**
     * Generate configuration hash from ability and policy IPFS CIDs
     */
    static generateConfigHash(abilityIpfsCids: string[], abilityPolicyCids: string[][]): string;
    /**
     * Auto-detect test filename from call stack
     */
    static autoDetectTestFileName(): string;
    /**
     * Get current configuration state, creating if needed
     */
    private getCurrentConfigState;
    /**
     * Set the real configuration hash based on ability/policy CIDs
     * This should be called before any state operations when CIDs are known
     */
    setConfigurationFromCIDs(abilityIpfsCids: string[], abilityPolicyCids: string[][]): void;
    /**
     * Update configuration metadata
     */
    updateConfigurationMetadata(abilityIpfsCids: string[], abilityPolicyCids: string[][]): void;
    /**
     * Generate app version key from appId and appVersion
     */
    private static generateAppVersionKey;
    /**
     * Save app version configuration
     */
    private saveAppVersionConfiguration;
    /**
       * Get or register Vincent app using app versioning approach
       */
    getOrRegisterVincentAppVersioned(delegateeAddress: string, registerAppFunction: () => Promise<{
        appId: number;
        appVersion: number;
    }>, registerNextVersionFunction: (appId: number) => Promise<{
        appId: number;
        appVersion: number;
    }>, abilityIpfsCids: string[], abilityPolicies: string[][], policyParams: PermissionData): Promise<{
        appId: number;
        appVersion: number;
        isNew: boolean;
        isNewVersion: boolean;
        abilityIpfsCids: string[];
        abilityPolicies: string[][];
        policyParams: PermissionData;
    }>;
    /**
     * Find matching app version based on ability/policy CIDs
     */
    private findMatchingAppVersion;
    loadState(): Promise<void>;
    saveState(): Promise<void>;
    generateAccount(): AccountState;
    getOrGenerateAccount(accountType: "appManager" | "appDelegatee" | "agentWalletPkpOwner", existingPrivateKey?: string): {
        privateKey: string;
        address: string;
        isNew: boolean;
    };
    /**
     * Get existing PKP or return undefined if needs minting
     */
    getExistingPKP(): PKPState | undefined;
    /**
     * Save a newly minted PKP to state
     */
    savePKP(pkpInfo: PKPInfo): void;
    /**
     * Get or mint the single testing PKP
     */
    getOrMintPKP(mintFunction: () => Promise<PKPInfo>): Promise<{
        pkp: PKPInfo;
        isNew: boolean;
    }>;
    /**
     * Check if capacity credits are still valid (not expired within 1 day)
     */
    private isCapacityCreditValid;
    /**
     * Get existing capacity credits or return undefined if needs minting
     */
    getExistingCapacityCredits(): CapacityCreditState | undefined;
    /**
     * Save newly minted capacity credits to state
     */
    saveCapacityCredits(capacityCreditInfo: CapacityCreditInfo): void;
    /**
     * Get or mint capacity credits for testing
     */
    getOrMintCapacityCredits(mintFunction: () => Promise<CapacityCreditInfo>): Promise<{
        capacityCredits: CapacityCreditInfo;
        isNew: boolean;
    }>;
    /**
     * Get existing Vincent app or return undefined if needs registration
     * First checks current config, then searches all configs for apps with same delegatee
     */
    getExistingVincentApp(delegateeAddress: string): VincentAppState | undefined;
    /**
     * Save a newly registered Vincent app to state
     */
    saveVincentApp(appId: number, appVersion: number, delegateeAddress: string, abilityIpfsCids: string[], abilityPolicies: string[][], policyParams: PermissionData): void;
    /**
     * Update existing Vincent app state with parameter values
     */
    updateVincentAppParameterValues(appId: number, policyParams: PermissionData): void;
    /**
     * Check if PKP is already permitted for the given app version
     */
    isPKPPermittedForAppVersion(pkpEthAddress: string, appId: number, appVersion: number): boolean;
    /**
     * Save PKP app permission to state
     */
    savePKPAppPermission(pkpEthAddress: string, appId: number, appVersion: number): void;
}
export {};
//# sourceMappingURL=state-manager.d.ts.map