import { BigRational } from 'big-rational-ts';
import { BigNumber } from 'bignumber.js';

// can be an uuid or a string like the unit of the token
export type AssetIdentifier = string;

export type PortfolioState<AssetAmountType, MtkSupplyType> = {
  /** How much (in the unit) of each asset the portfolio has been deposited */
  assets: Record<AssetIdentifier, AssetAmountType>;
  /** How many MTKs of the portfolio have been minted */
  mtkSupply: MtkSupplyType;
};

export type Prices = Record<AssetIdentifier, BigRational>;

/** Dictionary with the ratios of how much of each asset there is/should be in a portfolio */
export type Weights = Record<AssetIdentifier, BigRational>;

export type RationalDict = Record<AssetIdentifier, BigRational>;

/**
 * State of the portfolio at the moment of computation
 */
export type State = {
  /** Percentage multiplied by 100 (e.g. 324 is 3.24%) */
  entryFee: BigNumber;
  /** Percentage multiplied by 100 (e.g. 324 is 3.24%) */
  exitFee: BigNumber;
  /** Percentage multiplied by 100 (e.g. 324 is 3.24%) */
  platformFee: BigNumber;
  /** Lovelace value */
  batcherFee: BigNumber;
  /** Micro MTK price in lovelace*/
  microMtkPrice: BigNumber;
};

export type FeeComputation = {
  /** Type of interaction */
  type: 'mint' | 'burn';
  /** How much in lovelace the user wants to mint/burn in MTK */
  amount: BigNumber;
  /** The state of the portfolio to base the math on */
  portfolioState: State;
};
