import { BigNumber, ethers } from 'ethers';
import { BalanceView } from '../../types';

export const CONTRACT_NAMES = [
    'Accounting',
    'DepositManager',
    'LiqEth',
    'StakingModule',
    'WithdrawalQueue',
    'WithdrawalVault',

    //Outpost contracts
    'Depositor',
    'ReceiptNFT',
    'OutpostManager',
    'BAR',
    'OPP',
    'OPPCommon',
    'OPPInbound',
    'Pretoken',
    'Aggregator',
    'EthUsdPriceConsumer',
    'Pool',

] as const;

export type ContractName = typeof CONTRACT_NAMES[number];
export type AddressBook  = Record<ContractName, string>;


interface Result {
    /** EVM transaction hash */
    txHash: string;
    /** Full receipt, if you want it */
    receipt: ethers.providers.TransactionReceipt;
}


export interface DepositEvent {
    user: string;
    netEth: BigNumber;
    fee: BigNumber;
    shares: BigNumber;
}

export interface DepositResult extends Result {
    /** Parsed Deposited event, if present */
    deposited?: DepositEvent;
}

export interface WithdrawRequestedEvent {
    user: string;
    ethAmount: BigNumber;
    nftId: BigNumber;
    readyAt: string;
}

export interface WithdrawResult extends Result {
    /** Parsed WithdrawRequested event, if present */
    withdrawRequested?: WithdrawRequestedEvent;
}


export interface StakedEvent {
    user: string;
    amountLiq: BigNumber;
    shares: BigNumber;
    tokenId: BigNumber;
}

export interface StakedResult extends Result {
    /** Parsed Staked event, if present */
    staked?: StakedEvent;
}


export interface WithdrawnStakeEvent {
    user: string;
    tokenId: BigNumber;
    tokenOut: BigNumber;
}
export interface WithdrawnStakeResult extends Result {
    /** Parsed WithdrawnStake event, if present */
    withdrawnstake?: WithdrawnStakeEvent;

}

export interface SharesBurnedEvent {
    from: string;
    shares: BigNumber;
    tokenValue: BigNumber;
}

export interface preLaunchReceipt {
    tokenId: bigint;
    receipt: {
        account: string,
        currency: number,
        kind: number,
        indexAtMint: BalanceView,
        principal: BalanceView,
        shares: BalanceView,
        timestamp: string,
    }
}