import { z } from 'zod';
import { CreateCheckoutSchema, Checkout, UpdateCheckoutSchema } from './resources/checkout.mjs';
import { CreateCustomerParams, Customer, UpdateCustomerParams } from './resources/customer.mjs';
import { CreatePaymentSchema, Payment, UpdatePaymentSchema, CapturePaymentSchema } from './resources/payment.mjs';
import { CreateRefundSchema, Refund } from './resources/refund.mjs';
import { CreateSubscriptionSchema, Subscription, UpdateSubscriptionSchema } from './resources/subscription.mjs';
import { CustomerCreated, CustomerUpdated, CustomerDeleted, SubscriptionCreated, SubscriptionUpdated, SubscriptionCanceled, PaymentCreated, PaymentUpdated, PaymentSucceeded, PaymentFailed, RefundCreated, InvoiceGenerated, WebhookEventPayload } from './resources/webhook.mjs';

interface StandardEventHandlers {
    'customer.created': (event: CustomerCreated) => Promise<any>;
    'customer.updated': (event: CustomerUpdated) => Promise<any>;
    'customer.deleted': (event: CustomerDeleted) => Promise<any>;
    'subscription.created': (event: SubscriptionCreated) => Promise<any>;
    'subscription.updated': (event: SubscriptionUpdated) => Promise<any>;
    'subscription.canceled': (event: SubscriptionCanceled) => Promise<any>;
    'payment.created': (event: PaymentCreated) => Promise<any>;
    'payment.updated': (event: PaymentUpdated) => Promise<any>;
    'payment.succeeded': (event: PaymentSucceeded) => Promise<any>;
    'payment.failed': (event: PaymentFailed) => Promise<any>;
    'refund.created': (event: RefundCreated) => Promise<any>;
    'invoice.generated': (event: InvoiceGenerated) => Promise<any>;
}
type StandardWebhookEventType = keyof StandardEventHandlers;
type WebhookSetupConfig<TRaw extends Record<string, any>> = {
    /**
     * The secret key for the webhook. Pass null for providers that do not use a shared secret.
     */
    webhookSecret: string | null;
    /**
     * The provider for the webhook.
     */
    provider: PayKitProvider<any, any, TRaw>;
};
type WebhookHandlerConfig = {
    /**
     * The body of the webhook.
     */
    body: string;
    /**
     * The headers of the webhook.
     */
    headersAsObject: Record<string, string>;
    /**
     * The full URL of the webhook.
     */
    fullUrl: string;
};
/**
 * @template TRawEvents - Map of Namespaced Event Name -> Data Type
 * @example { 'stripe.payment_intent.succeeded': Stripe.PaymentIntent }
 */
declare class Webhook<TRawEvents extends Record<string, any> = Record<string, any>> {
    private handlers;
    private config;
    setup(config: WebhookSetupConfig<TRawEvents>): Webhook<TRawEvents>;
    on<T extends keyof StandardEventHandlers | keyof TRawEvents>(eventType: T, handler: T extends keyof StandardEventHandlers ? StandardEventHandlers[T] : T extends keyof TRawEvents ? (data: TRawEvents[T]) => Promise<any> : never): Webhook<TRawEvents>;
    handle(dto: WebhookHandlerConfig): Promise<void>;
}

interface ProviderMetadataRegistry {
    checkout?: any;
    customer?: any;
    payment?: any;
    subscription?: any;
    refund?: any;
}
interface PayKitProvider<TMetadata extends ProviderMetadataRegistry = ProviderMetadataRegistry, TNativeClient = any, TRawEvents extends Record<string, any> = Record<string, any>> {
    /**
     * The name of the provider implementation
     * This is a required property for agentic services on the provider
     */
    readonly providerName: string;
    readonly isSandbox: boolean;
    readonly providerVersion: string;
    /**
     * ESCAPE HATCH: Access the underlying SDK (Stripe, Adyen, etc.) directly.
     * This allows devs to use features we haven't mapped yet without leaving the ecosystem.
     */
    readonly _native: TNativeClient;
    /** Checkout */
    createCheckout(params: CreateCheckoutSchema<TMetadata['checkout']>): Promise<Checkout>;
    retrieveCheckout(id: string): Promise<Checkout | null>;
    updateCheckout(id: string, params: UpdateCheckoutSchema<TMetadata['checkout']>): Promise<Checkout>;
    deleteCheckout(id: string): Promise<null>;
    /** Customer */
    createCustomer(params: CreateCustomerParams<TMetadata['customer']>): Promise<Customer>;
    updateCustomer(id: string, params: UpdateCustomerParams<TMetadata['customer']>): Promise<Customer>;
    retrieveCustomer(id: string): Promise<Customer | null>;
    deleteCustomer(id: string): Promise<null>;
    /** Subscription */
    createSubscription(params: CreateSubscriptionSchema<TMetadata['subscription']>): Promise<Subscription>;
    updateSubscription(id: string, params: UpdateSubscriptionSchema<TMetadata['subscription']>): Promise<Subscription>;
    cancelSubscription(id: string): Promise<Subscription>;
    deleteSubscription(id: string): Promise<null>;
    retrieveSubscription(id: string): Promise<Subscription | null>;
    /** Payment */
    createPayment(params: CreatePaymentSchema<TMetadata['payment']>): Promise<Payment>;
    updatePayment(id: string, params: UpdatePaymentSchema<TMetadata['payment']>): Promise<Payment>;
    retrievePayment(id: string): Promise<Payment | null>;
    deletePayment(id: string): Promise<null>;
    capturePayment(id: string, params: CapturePaymentSchema): Promise<Payment>;
    cancelPayment(id: string): Promise<Payment>;
    /** Refund */
    createRefund(params: CreateRefundSchema<TMetadata['refund']>): Promise<Refund>;
    /** Webhook */
    handleWebhook(payload: WebhookHandlerConfig, webhookSecret: string | null): Promise<Array<WebhookEventPayload<TRawEvents>>>;
}
declare class AbstractPayKitProvider {
    readonly providerVersion: string;
    protected constructor(schema: z.ZodType<Record<string, unknown>>, options: unknown, providerName: string);
}

export { AbstractPayKitProvider as A, type PayKitProvider as P, type StandardEventHandlers as S, type WebhookSetupConfig as W, type ProviderMetadataRegistry as a, Webhook as b, type StandardWebhookEventType as c, type WebhookHandlerConfig as d };
