import { type Address } from 'viem';
import type { LooseOmit, MaybePromise, NoExtraKeys } from '../../internal/types.js';
import * as Method from '../../Method.js';
import * as Store from '../../Store.js';
import type * as Client from '../../viem/Client.js';
import * as Account from '../internal/account.js';
import type * as types from '../internal/types.js';
import * as Methods from '../Methods.js';
import type { SubscriptionAccessKey, SubscriptionCredentialPayload, SubscriptionLookup, SubscriptionPeriodUnit, SubscriptionRecord, SubscriptionReceipt as SubscriptionReceiptValue } from '../subscription/Types.js';
type SubscriptionRequest = ReturnType<typeof Methods.subscription.schema.request.parse>;
/**
 * Creates a Tempo subscription method for recurring TIP-20 token payments.
 *
 * The method handles activation, request-path reuse, and optional lazy renewals.
 */
export declare function subscription<const parameters extends subscription.Parameters>(p: NoExtraKeys<parameters, subscription.Parameters>): Method.Server<{
    readonly name: "tempo";
    readonly intent: "subscription";
    readonly schema: {
        readonly credential: {
            readonly payload: import("zod/mini").ZodMiniObject<{
                signature: import("zod/mini").ZodMiniString<string>;
                type: import("zod/mini").ZodMiniLiteral<"keyAuthorization">;
            }, import("zod/v4/core").$strip>;
        };
        readonly request: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniObject<{
            amount: import("zod/mini").ZodMiniString<string>;
            accessKey: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniObject<{
                accessKeyAddress: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniTransform<`0x${string}`, string>>;
                keyType: import("zod/mini").ZodMiniEnum<{
                    secp256k1: "secp256k1";
                    p256: "p256";
                    webAuthn: "webAuthn";
                }>;
            }, import("zod/v4/core").$strip>>;
            chainId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniNumber<number>>;
            currency: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniTransform<`0x${string}`, string>>;
            decimals: import("zod/mini").ZodMiniNumber<number>;
            description: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
            externalId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
            methodDetails: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniObject<{
                accessKey: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniObject<{
                    accessKeyAddress: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniTransform<`0x${string}`, string>>;
                    keyType: import("zod/mini").ZodMiniEnum<{
                        secp256k1: "secp256k1";
                        p256: "p256";
                        webAuthn: "webAuthn";
                    }>;
                }, import("zod/v4/core").$strip>>;
                chainId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniNumber<number>>;
            }, import("zod/v4/core").$strip>>;
            periodCount: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniUnion<readonly [import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniBigInt<bigint>, import("zod/mini").ZodMiniCustom<number, number>]>, import("zod/mini").ZodMiniTransform<string, string | number | bigint>>;
            periodUnit: import("zod/mini").ZodMiniEnum<{
                day: "day";
                week: "week";
            }>;
            recipient: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniTransform<`0x${string}`, string>>;
            subscriptionExpires: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniUnion<readonly [import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniCustom<Date, Date>]>, import("zod/mini").ZodMiniTransform<Date, import("../../zod.js").DatetimeInput>>;
        }, import("zod/v4/core").$strip>, import("zod/mini").ZodMiniTransform<{
            methodDetails?: {
                accessKey?: import("zod").infer<import("zod/mini").ZodMiniObject<{
                    accessKeyAddress: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniTransform<`0x${string}`, string>>;
                    keyType: import("zod/mini").ZodMiniEnum<{
                        secp256k1: "secp256k1";
                        p256: "p256";
                        webAuthn: "webAuthn";
                    }>;
                }, import("zod/v4/core").$strip>> | undefined;
                chainId?: number | undefined;
            } | undefined;
            amount: string;
            subscriptionExpires: string;
            currency: `0x${string}`;
            periodCount: string;
            periodUnit: "day" | "week";
            recipient: `0x${string}`;
            description?: string | undefined;
            externalId?: string | undefined;
        }, {
            amount: string;
            currency: `0x${string}`;
            decimals: number;
            periodCount: string;
            periodUnit: "day" | "week";
            recipient: `0x${string}`;
            subscriptionExpires: Date;
            accessKey?: {
                accessKeyAddress: `0x${string}`;
                keyType: "secp256k1" | "p256" | "webAuthn";
            } | undefined;
            chainId?: number | undefined;
            description?: string | undefined;
            externalId?: string | undefined;
            methodDetails?: {
                accessKey?: {
                    accessKeyAddress: `0x${string}`;
                    keyType: "secp256k1" | "p256" | "webAuthn";
                } | undefined;
                chainId?: number | undefined;
            } | undefined;
        }>>;
    };
}, subscription.DeriveDefaults<parameters>, undefined>;
/**
 * Renews an overdue subscription outside of the HTTP request path.
 * Intended for cron jobs or background workers that bill subscriptions on a schedule.
 *
 * Returns the renewal result if the subscription was overdue, or `null` if already current.
 */
export declare function renew(parameters: renew.Parameters): Promise<renew.Result | null>;
export declare namespace renew {
    /** Parameters for renewing an overdue subscription outside the request path. */
    type Parameters = {
        /** The subscription to renew. */
        subscriptionId: string;
        /** Billing callback — same signature as the `renew` hook on {@link subscription}. */
        renew?: ((parameters: {
            /** Stable idempotency/reconciliation reference persisted before the renewal hook runs. */
            inFlightReference: string;
            periodIndex: number;
            subscription: SubscriptionRecord;
        }) => Promise<subscription.RenewalResult>) | undefined;
        /** Store containing subscription records. */
        store: Store.AtomicStore<Record<string, unknown>>;
        /**
         * Milliseconds before an in-flight renewal lock can be replaced.
         * Keeps concurrent renewal safe while allowing recovery from abandoned attempts.
         */
        renewalTimeoutMs?: number | undefined;
        waitForConfirmation?: boolean | undefined;
    } & Client.getResolver.Parameters;
    /** Renewal result returned by {@link renew}. */
    type Result = subscription.RenewalResult;
}
export declare namespace subscription {
    /** Request-scoped lookup key used to find the active subscription. */
    type ResolvedSubscription = SubscriptionLookup;
    /** Activation result returned after the initial credential is verified. */
    type ActivationResult = {
        receipt: SubscriptionReceiptValue;
        subscription: SubscriptionRecord;
    };
    /** Renewal result returned when an overdue subscription is charged. */
    type RenewalResult = {
        receipt: SubscriptionReceiptValue;
        subscription: SubscriptionRecord;
    };
    /** Request defaults supported by the subscription method. */
    type Defaults = LooseOmit<Method.RequestDefaults<typeof Methods.subscription>, 'accessKey' | 'recipient'>;
    /** Parameters for configuring a Tempo subscription method. */
    type Parameters = Account.resolve.Parameters & Client.getResolver.Parameters & {
        accessKey?: ((parameters: {
            input: Request;
            request: SubscriptionRequest;
            resolved: ResolvedSubscription;
        }) => MaybePromise<SubscriptionAccessKey>) | undefined;
        /**
         * Milliseconds before an in-flight activation lock can be replaced.
         * Keeps concurrent activation safe while allowing recovery from abandoned attempts.
         */
        activationTimeoutMs?: number | undefined;
        /**
         * Milliseconds before an in-flight renewal lock can be replaced.
         * Keeps concurrent renewal safe while allowing recovery from abandoned attempts.
         */
        renewalTimeoutMs?: number | undefined;
        activate?: ((parameters: {
            /** Custom activation must verify this access key matches the resolved subscription. */
            accessKey: SubscriptionAccessKey;
            credential: {
                payload: SubscriptionCredentialPayload;
                source?: string | undefined;
            };
            input: Request;
            request: SubscriptionRequest;
            resolved: ResolvedSubscription;
            source: {
                address: Address;
                chainId: number;
            } | null;
        }) => Promise<ActivationResult>) | undefined;
        hooks?: {
            activated?: ((parameters: {
                receipt: SubscriptionReceiptValue;
                subscription: SubscriptionRecord;
            }) => MaybePromise<void>) | undefined;
            renewed?: ((parameters: {
                periodIndex: number;
                receipt: SubscriptionReceiptValue;
                subscription: SubscriptionRecord;
            }) => MaybePromise<void>) | undefined;
        } | undefined;
        periodCount?: Methods.SubscriptionPeriodCountInput | undefined;
        periodUnit?: SubscriptionPeriodUnit | undefined;
        /**
         * Resolves the request identity. This callback must authenticate and
         * authorize the caller before returning a key; automatic mode may create
         * a server-owned access key for that key while issuing a challenge.
         */
        resolve: (parameters: {
            input: Request;
            request: SubscriptionRequest;
        }) => MaybePromise<ResolvedSubscription | null>;
        renew?: (parameters: {
            /** Stable idempotency/reconciliation reference persisted before the renewal hook runs. */
            inFlightReference: string;
            periodIndex: number;
            /** Custom renewal hooks must preserve amount, currency, recipient, period, expiry, and lookup key. */
            subscription: SubscriptionRecord;
        }) => Promise<RenewalResult>;
        store?: Store.AtomicStore<Record<string, unknown>> | undefined;
        testnet?: boolean | undefined;
        waitForConfirmation?: boolean | undefined;
    } & Defaults;
    /** Derived defaults after account and chain configuration are applied. */
    type DeriveDefaults<parameters extends Parameters> = types.DeriveDefaults<parameters, Defaults> & {
        decimals: number;
    };
}
export {};
//# sourceMappingURL=Subscription.d.ts.map