import { d as CustomerProduct, e as CustomerFeature, f as CustomerInvoice, C as CustomerData, A as AppEnv, I as Infinite, P as ProductItemIntervalType, g as UsageModel, F as FreeTrialDuration, h as UsageModelType } from './cusTypes-BD42O-7Z.js';

type EntityExpandOption = "invoices";

interface CreateEntityParams {
    id: string;
    name: string;
    feature_id: string;
    customer_data?: CustomerData;
}
interface CreateEntityResult {
    success: boolean;
}
interface DeleteEntityResult {
    success: boolean;
}
interface GetEntityParams$1 {
    expand?: EntityExpandOption[];
}
interface Entity {
    id: string;
    name: string;
    customer_id: string;
    created_at: number;
    env: string;
    products: CustomerProduct[];
    features: Record<string, CustomerFeature>;
    invoices?: CustomerInvoice[];
}
interface EntityData {
    name?: string;
    feature_id: string;
}

interface ProductItem {
    feature_id?: string;
    included_usage?: number | typeof Infinite;
    interval?: ProductItemIntervalType;
    usage_model?: UsageModel;
    price?: number;
    billing_units?: number;
    entity_feature_id?: string;
    reset_usage_on_billing?: boolean;
    reset_usage_when_enabled?: boolean;
}
interface FreeTrial {
    duration: FreeTrialDuration;
    length: number;
    unique_fingerprint: boolean;
}
interface Product {
    autumn_id: string;
    created_at: number;
    id: string;
    name: string;
    env: AppEnv;
    is_add_on: boolean;
    is_default: boolean;
    group: string;
    version: number;
    items: ProductItem[];
    free_trial: FreeTrial | null;
}
interface CreateProductParams {
    id: string;
    name?: string;
    is_add_on?: boolean;
    is_default?: boolean;
    items?: ProductItem[];
    free_trial?: FreeTrial;
}
interface ListProductsParams {
}

type CheckFeatureScenario = "usage_limit" | "feature_flag";
interface CheckFeatureFormattedPreview {
    scenario: CheckFeatureScenario;
    title: string;
    message: string;
    feature_id: string;
    feature_name: string;
    products: Product[];
}
type CheckProductScenario = "scheduled" | "active" | "new" | "renew" | "upgrade" | "downgrade" | "cancel";
interface CheckProductFormattedPreview {
    scenario: CheckProductScenario;
    product_id: string;
    product_name: string;
    recurring: boolean;
    error_on_attach?: boolean;
    next_cycle_at?: number;
    current_product_name?: string;
    items?: {
        price: string;
        description: string;
        usage_model?: UsageModelType;
    }[];
    options?: {
        feature_id: string;
        feature_name: string;
        billing_units: number;
        price?: number;
        tiers?: {
            to: number | string;
            amount: number;
        }[];
    }[];
    due_today?: {
        price: number;
        currency: string;
    };
    due_next_cycle?: {
        price: number;
        currency: string;
    };
}

interface AttachFeatureOptions {
    feature_id: string;
    quantity: number;
}
interface AttachParams {
    customer_id: string;
    product_id?: string;
    entity_id?: string;
    options?: AttachFeatureOptions[];
    product_ids?: string[];
    free_trial?: boolean;
    success_url?: string;
    metadata?: Record<string, string>;
    force_checkout?: boolean;
    customer_data?: CustomerData;
    entity_data?: EntityData;
    checkout_session_params?: Record<string, any>;
    reward?: string;
}
interface CancelParams {
    customer_id: string;
    product_id: string;
    entity_id?: string;
    cancel_immediately?: boolean;
}
interface CancelResult {
    success: boolean;
    customer_id: string;
    product_id: string;
}
interface AttachResult {
    checkout_url?: string;
    customer_id: string;
    product_ids: string[];
    code: string;
    message: string;
    customer_data?: CustomerData;
}
interface TrackParams {
    customer_id: string;
    value?: number;
    feature_id?: string;
    event_name?: string;
    entity_id?: string;
    customer_data?: CustomerData;
    idempotency_key?: string;
    entity_data?: EntityData;
}
interface TrackResult {
    id: string;
    code: string;
    customer_id: string;
    feature_id?: string;
    event_name?: string;
}
interface CheckParams {
    customer_id: string;
    feature_id?: string;
    product_id?: string;
    entity_id?: string;
    customer_data?: CustomerData;
    required_balance?: number;
    send_event?: boolean;
    with_preview?: "raw" | "formatted";
    entity_data?: EntityData;
}
interface CheckResult {
    customer_id: string;
    allowed: boolean;
    code: string;
    feature_id?: string;
    required_balance?: number;
    unlimited?: boolean;
    balance?: number | null;
    product_id?: string;
    status?: string;
    preview?: CheckProductFormattedPreview | CheckFeatureFormattedPreview;
}
interface UsageParams {
    customer_id: string;
    feature_id: string;
    value: number;
    customer_data?: CustomerData;
}
interface UsageResult {
    code: string;
    customer_id: string;
    feature_id: string;
}

interface GetEntityParams {
    expand?: string[];
}
interface EntityDataParams {
    name?: string;
    featureId: string;
}

export type { AttachParams as A, CreateProductParams as C, DeleteEntityResult as D, Entity as E, GetEntityParams$1 as G, ListProductsParams as L, Product as P, TrackParams as T, UsageParams as U, CreateEntityParams as a, CreateEntityResult as b, AttachResult as c, UsageResult as d, CancelParams as e, CancelResult as f, CheckParams as g, CheckResult as h, TrackResult as i, GetEntityParams as j, AttachFeatureOptions as k, EntityDataParams as l };
