import type { Context } from '../context.js';
import type { AnyTimeRange, Currency } from './types.js';
import type { Decimal, _ConfigApplicationContext } from '../../stdlib/index.js';
/** @public */
export declare namespace RecurringBillingItemHandling {
    /** @public */
    type PricingTierMode = 'graduated' | 'volume';
    /** @public */
    type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
    /** @public */
    type PriceType = 'one_time' | 'recurring';
    /** @public */
    type PricingScheme = 'per_unit' | 'tiered';
    /** @public */
    type UsageType = 'licensed' | 'metered';
    /** @public */
    type ItemType = 'credit' | 'debit';
    /**
     * The result of the group items extension.
     * @public
     */
    interface GroupItemsResult {
        /** The groups of items, each corresponding to a separate invoice. */
        groups: ItemGroup[];
    }
    /**
     * A group of items to place on a single invoice.
     * @public
     */
    interface ItemGroup {
        /** The items in this group. */
        items: GroupedItem[];
        /** Whether this group sets the latest invoice reference on the subscription. */
        setsLatestInvoice: boolean;
    }
    /**
     * An item assigned to a group.
     * @public
     */
    interface GroupedItem {
        /** The unique identifier of the item, matching a key from the input. */
        key: string;
    }
    /**
     * The input to the group items extension.
     * @public
     */
    interface GroupItemsInput {
        /** The list of items to group across invoices. */
        items: Item[];
    }
    /** @public */
    type Item = ({
        customPricingUnitOverageRate: CustomPricingUnitOverageRate;
        priceKind: 'customPricingUnitOverageRate';
    } | {
        licenseFee: LicenseFee;
        priceKind: 'licenseFee';
    } | {
        otherPriceKind: string;
        priceKind: 'other';
    } | {
        price: Price;
        priceKind: 'price';
    } | {
        priceKind: 'rateCardRate';
        rateCardRate: RateCardRate;
    }) & {
        isProration: boolean;
        key: string;
        prorationFactor: Decimal;
        servicePeriod: AnyTimeRange;
        type: ItemType;
    };
    /** @public */
    interface CustomPricingUnitOverageRate {
        id: string;
        metadata: Record<string, string>;
        rateCard: RateCard;
        customPricingUnit: string;
        unitAmount: Decimal;
    }
    /** @public */
    interface RateCard {
        id: string;
        currency: Currency;
    }
    /** @public */
    interface RateCardRate {
        id: string;
        metadata: Record<string, string>;
        rateCard: RateCard;
        tieringMode?: PricingTierMode;
        tiers: RateCardRateTier[];
        unitAmount?: Decimal;
    }
    /** @public */
    interface RateCardRateTier {
        flatAmount?: Decimal;
        unitAmount?: Decimal;
        upTo?: Decimal;
    }
    /** @public */
    interface LicenseFee {
        id: string;
        lookupKey?: string;
        metadata: Record<string, string>;
        serviceInterval: RecurringPriceInterval;
        serviceIntervalCount: number;
        tieringMode?: PricingTierMode;
        tiers: LicenseFeeTier[];
        currency: Currency;
        unitAmount?: Decimal;
    }
    /** @public */
    interface LicenseFeeTier {
        flatAmount?: Decimal;
        unitAmount?: Decimal;
        upTo?: Decimal;
    }
    /** @public */
    interface Price {
        id: string;
        product: Product;
        recurring?: RecurringPrice;
        billingScheme: PricingScheme;
        tiers: PriceTier[];
        type: PriceType;
        tiersMode?: PricingTierMode;
        metadata: Record<string, string>;
        currency: Currency;
        unitAmount?: Decimal;
    }
    /** @public */
    interface PriceTier {
        flatAmount?: Decimal;
        unitAmount?: Decimal;
        upTo?: number;
    }
    /** @public */
    interface RecurringPrice {
        interval: RecurringPriceInterval;
        intervalCount: number;
        usageType?: UsageType;
        meter?: string;
    }
    /** @public */
    interface Product {
        id: string;
        name: string;
        metadata: Record<string, string>;
    }
    /**
     * The result of the filter items extension.
     * @public
     */
    interface FilterItemsResult {
        /** The items to include on the invoice. */
        items: ItemToInvoice[];
    }
    /**
     * An item selected for inclusion on the invoice.
     * @public
     */
    interface ItemToInvoice {
        /** The unique identifier of the item, matching a key from the input. */
        key: string;
    }
    /**
     * The input to the filter items extension.
     * @public
     */
    interface FilterItemsInput {
        /** The list of items to evaluate for inclusion on the invoice. */
        items: Item[];
    }
    /**
     * The result of the before item creation extension.
     * @public
     */
    interface BeforeItemCreationResult {
        /** The items with their creation strategies. */
        items: ItemWithCreationStrategy[];
    }
    /** @public */
    type ItemWithCreationStrategy = ({
        creationStrategy: 'other';
        otherCreationStrategy: string;
    } | { creationStrategy: 'doNotCreate' } | { creationStrategy: 'invoice' }) & { key: string };
    /** @public */
    type Invoice = Record<string, never>;
    /** @public */
    type DoNotCreate = Record<string, never>;
    /**
     * The input to the before item creation extension.
     * @public
     */
    interface BeforeItemCreationInput {
        /** The list of items to evaluate for creation. */
        items: Item[];
    }
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareArgsBeforeItemCreation(proto: unknown): BeforeItemCreationInput;
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareResultBeforeItemCreation(result: BeforeItemCreationResult): BeforeItemCreationResult;
    /** @internal */
    function $platformWrapBeforeItemCreation(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { beforeItemCreation(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareArgsFilterItems(proto: unknown): FilterItemsInput;
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareResultFilterItems(result: FilterItemsResult): FilterItemsResult;
    /** @internal */
    function $platformWrapFilterItems(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { filterItems(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareArgsGroupItems(proto: unknown): GroupItemsInput;
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareResultGroupItems(result: GroupItemsResult): GroupItemsResult;
    /** @internal */
    function $platformWrapGroupItems(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { groupItems(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
    /**
     * Runs before invoice items are created. Decides whether each item should be created or skipped.
     * @public
     */
    type BeforeItemCreationFunction<Config> = (request: BeforeItemCreationInput, config: Config, context: Context) => BeforeItemCreationResult;
    /**
     * Runs before invoices are created. Decides which items to include on the invoice. Items not included are deferred as pending invoice items.
     * @public
     */
    type FilterItemsFunction<Config> = (request: FilterItemsInput, config: Config, context: Context) => FilterItemsResult;
    /**
     * Runs before invoices are created. Decides how items are grouped across one or more invoices.
     * @public
     */
    type GroupItemsFunction<Config> = (request: GroupItemsInput, config: Config, context: Context) => GroupItemsResult;
}
/**
 * @example
 * ```ts
 * import type { Billing, Context } from '@stripe/extensibility-sdk';
 *
 * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
 * interface MyRecurringBillingItemHandlingConfig {}
 *
 * export default class MyRecurringBillingItemHandling implements Billing.RecurringBillingItemHandling<MyRecurringBillingItemHandlingConfig> {
 *   beforeItemCreation(
 *     _request: Billing.RecurringBillingItemHandling.BeforeItemCreationInput,
 *     _config: MyRecurringBillingItemHandlingConfig,
 *     _context: Context
 *   ) {
 *     // TODO: implement your before-item-creation logic here
 *
 *     return {
 *       items: [],
 *     };
 *   }
 *
 *   filterItems(
 *     _request: Billing.RecurringBillingItemHandling.FilterItemsInput,
 *     _config: MyRecurringBillingItemHandlingConfig,
 *     _context: Context
 *   ) {
 *     // TODO: implement your filter-items logic here
 *
 *     return {
 *       items: [],
 *     };
 *   }
 *
 *   groupItems(
 *     _request: Billing.RecurringBillingItemHandling.GroupItemsInput,
 *     _config: MyRecurringBillingItemHandlingConfig,
 *     _context: Context
 *   ) {
 *     // TODO: implement your group-items logic here
 *
 *     return {
 *       groups: [],
 *     };
 *   }
 * }
 *
 * ```
 * @public
 */
export interface RecurringBillingItemHandling<Config> {
    beforeItemCreation: RecurringBillingItemHandling.BeforeItemCreationFunction<Config>;
    filterItems: RecurringBillingItemHandling.FilterItemsFunction<Config>;
    groupItems: RecurringBillingItemHandling.GroupItemsFunction<Config>;
}
//# sourceMappingURL=recurring_billing_item_handling.d.ts.map