/**
 * Typed Authorization Parameters using Discriminated Unions
 *
 * This file defines type-safe authorization parameter types that replace
 * the generic `Record<string, any>` previously used in AuthorizationRequest.
 *
 * Each authorization action has its own specific parameter type, ensuring
 * compile-time safety and better IDE support.
 */
import { UCD, Satoshis, UnixTimestamp } from "./branded/domain-values";
/**
 * Base authorization parameters shared by all authorization types
 */
interface BaseAuthParams {
    /** Unix timestamp when the authorization request was created */
    timestamp: UnixTimestamp;
    /** Chain ID where the operation will be executed */
    chainId: number;
}
/**
 * Parameters for creating a new loan/position
 */
export interface CreateLoanAuthParams extends BaseAuthParams {
    type: "create";
    /** Selected loan term in months (e.g., 12, 24, 36) */
    selectedTerm: number;
    /** Borrower's Ethereum address */
    borrower: string;
    /** PKP public key for Bitcoin custody */
    publicKey: string;
}
/**
 * Parameters for minting UCD against existing collateral
 */
export interface MintUCDAuthParams extends BaseAuthParams {
    type: "mint";
    /** Position/loan identifier */
    positionId: string;
    /** Amount of UCD to mint (in wei, 18 decimals) */
    amount: UCD;
    /** PKP public key (optional - validator PKP is passed separately to authorizeMintUCD) */
    publicKey?: string;
    /** Bitcoin provider URL for balance verification */
    bitcoinProviderUrl?: string;
    /** Selected term in months (override when contract state is zero) */
    selectedTerm?: number;
}
/**
 * Parameters for withdrawing Bitcoin from vault
 */
export interface WithdrawBTCAuthParams extends BaseAuthParams {
    type: "withdraw";
    /** Position/loan identifier */
    positionId: string;
    /** Destination Bitcoin address */
    destinationAddress: string;
    /** Amount to withdraw in satoshis */
    amount: Satoshis;
    /** PKP public key */
    publicKey: string;
}
/**
 * Parameters for repaying UCD debt
 */
export interface RepayDebtAuthParams extends BaseAuthParams {
    type: "repay";
    /** Position/loan identifier */
    positionId: string;
    /** Amount of UCD to repay (in wei, 18 decimals) */
    amount: UCD;
    /** Whether this is a full repayment closing the position */
    closeLoan: boolean;
}
/**
 * Parameters for extending loan term
 */
export interface ExtendTermAuthParams extends BaseAuthParams {
    type: "extend";
    /** Position/loan identifier */
    positionId: string;
    /** New term length in months */
    newTerm: number;
    /** Expected extension fee in UCD */
    extensionFee: UCD;
}
/**
 * Parameters for closing a position
 */
export interface ClosePositionAuthParams extends BaseAuthParams {
    type: "close";
    /** Position/loan identifier */
    positionId: string;
    /** Final debt amount being repaid */
    finalDebt: UCD;
}
/**
 * Union type of all possible authorization parameters
 *
 * This is a discriminated union keyed by the 'type' field.
 * TypeScript can narrow the type based on the 'type' value.
 *
 * @example
 * ```typescript
 * function handleAuth(params: AuthorizationParams) {
 *   switch (params.type) {
 *     case 'mint':
 *       // TypeScript knows params has positionId, amount, publicKey
 *       return handleMint(params.positionId, params.amount);
 *     case 'withdraw':
 *       // TypeScript knows params has destinationAddress
 *       return handleWithdraw(params.destinationAddress, params.amount);
 *   }
 * }
 * ```
 */
export type AuthorizationParams = CreateLoanAuthParams | MintUCDAuthParams | WithdrawBTCAuthParams | RepayDebtAuthParams | ExtendTermAuthParams | ClosePositionAuthParams;
/**
 * Type guard to check if params are for loan creation
 */
export declare function isCreateLoanAuth(params: AuthorizationParams): params is CreateLoanAuthParams;
/**
 * Type guard to check if params are for UCD minting
 */
export declare function isMintUCDAuth(params: AuthorizationParams): params is MintUCDAuthParams;
/**
 * Type guard to check if params are for BTC withdrawal
 */
export declare function isWithdrawBTCAuth(params: AuthorizationParams): params is WithdrawBTCAuthParams;
/**
 * Type guard to check if params are for debt repayment
 */
export declare function isRepayDebtAuth(params: AuthorizationParams): params is RepayDebtAuthParams;
/**
 * Type guard to check if params are for term extension
 */
export declare function isExtendTermAuth(params: AuthorizationParams): params is ExtendTermAuthParams;
/**
 * Type guard to check if params are for position closure
 */
export declare function isClosePositionAuth(params: AuthorizationParams): params is ClosePositionAuthParams;
/**
 * Helper to extract the action type from authorization params
 */
export declare function getAuthActionType(params: AuthorizationParams): string;
/**
 * Validation helpers for authorization parameters
 */
export declare namespace AuthParamsValidation {
    function validateCreateLoan(params: CreateLoanAuthParams): string[];
    function validateMintUCD(params: MintUCDAuthParams): string[];
    function validateWithdrawBTC(params: WithdrawBTCAuthParams): string[];
    function validateRepayDebt(params: RepayDebtAuthParams): string[];
    function validateExtendTerm(params: ExtendTermAuthParams): string[];
    function validateClosePosition(params: ClosePositionAuthParams): string[];
    /**
     * Validates authorization params based on their type
     */
    function validate(params: AuthorizationParams): string[];
}
export {};
