import { l as VoucherState, d as FulfillmentSchema, k as Voucher } from './schema-BKDZ5rS8.js';
import { Transaction } from '@platform-modules/db';
import '@platform-modules/commerce-orders';
import 'drizzle-orm/pg-core';

interface RedeemEvent {
    currentState?: VoucherState;
    at: Date;
    scanningVendorId?: string;
    expiresAt: Date | null;
    vendorId: string | null;
}
type RedeemDecision = {
    ok: true;
} | {
    ok: false;
    reason: 'ALREADY_REDEEMED' | 'EXPIRED' | 'WRONG_VENDOR' | 'INVALID';
};
declare function decideRedemption(state: VoucherState, event: RedeemEvent): RedeemDecision;

declare function issueVoucher(tx: Transaction<FulfillmentSchema>, input: {
    orderId: string;
    lineId: string;
    qty: number;
    vendorId: string | null;
    expiresAt: Date | null;
}): Promise<Voucher[]>;

declare function redeemVoucher(tx: Transaction<FulfillmentSchema>, input: {
    voucherId: string;
    scanningVendorId: string;
}): Promise<Voucher>;

export { type RedeemDecision, type RedeemEvent, Voucher, VoucherState, decideRedemption, issueVoucher, redeemVoucher };
