/**
 * Loan Operations Interfaces
 */
import { LoanStatus } from "../../types/loanStatus";
export type BitcoinAddresses = {
    mainnet: string;
    testnet: string;
    regtest: string;
};
/**
 * Create Loan Request Interface
 */
export interface CreateLoanRequest {
    selectedTerm: number;
}
/**
 * PKP Validation Data Interface
 */
export interface PKPValidationData {
    tokenId: string;
    publicKey: string;
    ethAddress: string;
    validationSignature: string;
    btcAddresses: {
        mainnet: string;
        testnet: string;
        regtest: string;
    };
}
/**
 * Create Loan Result Interface
 */
export interface CreateLoanResult {
    success: boolean;
    error?: string;
    transactionHash?: string;
    positionId?: string;
    pkpData?: PKPValidationData;
    vaultAddress?: string;
    auditTrail?: {
        pkpCreation: any;
        validation: any;
        contractCall: any;
    };
}
/**
 * Loan Data Interface (Graph/SDK simplified shape)
 */
export interface LoanData {
    id: string;
    pkpId: string;
    borrower: {
        createdAt: number;
        id: string;
    };
    createdAt: number;
    lastUpdatedAt: number;
    loan: {
        ucdMinted: number;
        ucdPaid: number;
        ucdDebt: number;
        selectedTerm: number;
        status: LoanStatus;
        expiryAt: number;
    };
    collateral: {
        vaultAddress: string | BitcoinAddresses;
    };
}
/**
 * Paginated Loans Response Interface
 * Used by loan query methods that support pagination
 */
export interface PaginatedLoansResponse {
    loans: LoanData[];
    page: number;
    maxRows: number;
    totalLoans: number;
}
/**
 * Detailed Loan Data Interface (used by getLoanById / PKP)
 */
export interface LoanDataDetail {
    id: string;
    pkpId: string;
    borrower: {
        id: string;
        createdAt: number;
    };
    createdAt: number;
    createdAtBlock: number;
    lastUpdatedAt: number;
    lastUpdatedAtBlock: number;
    expiryAt: number;
    loan: {
        ucdMinted: number;
        ucdPaid: number;
        ucdDebt: number;
        status: LoanStatus;
        expiryAt: number;
        currentTerm: {
            id: string;
            createdAt: number;
            selectedTerm: number;
            extensionFeeRate: number;
            extensionFeeUCD: number;
        };
        extensions: {
            extendedAt: number;
            expiredAt: number;
            term: number;
            extensionFeeRate: number;
            extensionFeeUCD: number;
        };
        totalExtensions: number;
        payments: Array<{
            amount: number;
            blockNumber: number;
            id: string;
            newCollateralRatio: number;
            newDebt: number;
            payer: {
                id: string;
            };
            createdAt: number;
            transactionHash: string;
            type: string;
        }>;
        totalPayments: number;
        totalPaid: number;
    };
    collateral: {
        vaultAddress: string | BitcoinAddresses;
    };
    liquidation: {
        blockNumber: number;
        collateralSeized: number;
        commitHash: string;
        commitTimestamp: string;
        id: string;
        liquidatedAmount: number;
        liquidator: string;
        revealDelay: string;
        timestamp: number;
        transactionHash: string;
    };
}
/**
 * Loans Query Interface
 */
export interface LoansQuery {
    ownerWalletAddress?: string;
    status?: LoanStatus;
    expiryRange?: {
        from: number;
        to: number;
    };
    creationRange?: {
        from: number;
        to: number;
    };
}
/**
 * UCD Mint Request Interface
 */
export interface UCDMintRequest {
    positionId: string;
    amount: number;
    selectedTerm?: number;
    skipValidation?: boolean;
    rpcUrl?: string;
    testBtcPrice?: number;
    debugOverrides?: {
        useStubbedBtcData?: boolean;
        stubbedBtcPriceUsd?: string;
        stubbedAvailableBtcSats?: string;
        stubbedAuthorizedSpendsHash?: string;
    };
}
/**
 * UCD Mint Result Interface
 */
export interface UCDMintResult {
    success: boolean;
    transactionHash?: string;
    blockNumber?: number;
    blockHash?: string;
    gasUsed?: string;
    effectiveGasPrice?: string;
    positionId?: string;
    amountMinted?: string;
    amountMintedUCD?: number;
    error?: string;
}
/**
 * Renew Position Result Interface
 */
export interface RenewPositionResult {
    success: boolean;
    transactionHash?: string;
    blockNumber?: number;
    blockHash?: string;
    gasUsed?: string;
    effectiveGasPrice?: string;
    positionId?: string;
    extensionTerm?: number;
    newExpiryAt?: number;
    error?: string;
}
/**
 * Renew Position Request Interface
 */
export interface RenewPositionRequest {
    positionId: string;
    selectedTerm: number;
}
/**
 * BTC Withdrawal Result Interface
 */
export interface BTCWithdrawalResult {
    success: boolean;
    evmTransactionHash?: string;
    blockNumber?: number;
    blockHash?: string;
    gasUsed?: string;
    effectiveGasPrice?: string;
    positionId?: string;
    withdrawalAddress?: string;
    networkFee?: number;
    amountWithdrawn?: string;
    bitcoinTransactionHash?: string;
    utxoTxid?: string;
    utxoVout?: number;
    /** Full satoshi value of the authorized UTXO; needed by Phase 2 broadcast. */
    utxoSatoshis?: string;
    error?: string;
}
/**
 * Liquidation Request Interface
 */
export interface LiquidationRequest {
    positionId: string;
    forceContractCall?: boolean;
    /**
     * When true, the SDK will not send a UCD `approve(UCDController, …)` transaction.
     * Use when the liquidator wallet has already approved UCDController (e.g. multisig flow).
     * If allowance is insufficient, liquidation returns an error instead of approving.
     */
    skipUcdApproval?: boolean;
    rpcUrl?: string;
}
/**
 * Liquidation Result Interface
 */
export interface LiquidationResult {
    success: boolean;
    error?: string;
    transactionHash?: string;
    blockNumber?: number;
    positionId?: string;
    debtAmount?: string;
    collateralAmount?: string;
    wasLiquidated?: boolean;
    notLiquidatedReason?: string;
    btcPrice?: string;
    btcVaultBalance?: string;
}
/**
 * Partial Payment Request Interface
 */
export interface PartialPaymentRequest {
    positionId: string;
    paymentAmount: number;
    rpcUrl?: string;
}
/**
 * Confirm Balance Result Interface
 */
export interface ConfirmBalanceResult {
    success: boolean;
    transactionHash?: string;
    blockNumber?: number;
    blockHash?: string;
    gasUsed?: string;
    effectiveGasPrice?: string;
    positionId?: string;
    confirmedBalance?: string;
    btcPrice?: string;
    newStatus?: LoanStatus;
    error?: string;
}
/**
 * Confirm Balance Request Interface
 */
export interface ConfirmBalanceRequest {
    positionId: string;
}
/**
 * Partial Payment Result Interface
 */
export interface PartialPaymentResult {
    success: boolean;
    transactionHash?: string;
    blockNumber?: number;
    blockHash?: string;
    gasUsed?: string;
    effectiveGasPrice?: string;
    positionId?: string;
    paymentAmountUCD?: number;
    error?: string;
}
/**
 * Term with Fees Interface
 */
export interface TermWithFees {
    termMonths: number;
    originationFeeBps: number;
    extensionFeeBps: number;
}
/**
 * Terms with Fees Result Interface
 */
export interface TermsWithFeesResult {
    terms: TermWithFees[];
}
/**
 * Configuration for Loan Operations Manager
 */
export interface LoanManagerConfig {
    debug?: boolean;
}
