import { CONTRACT_INTERFACES as CI } from '../..'

export interface IPortfolioViewEntry {
	reference: string
	pricing: CI.ITradeIdeaPricing
	price: CI.IPrice
	notes: string
	title?: string // only for open
	asset: {
		ticker: string
		description?: string // only for open
		image?: CI.ITradeIdeaImage // only for open
		alternativeProviderSymbols?: CI.ITradeIdeaIdeaAlternativeProviderSymbol[] // only for open
	}
	direction?: 'long' | 'short' // only for open
	// reuse in open and for calculate adjustment
	allocation: number
}

export interface IPortfolioView {
	strategyKey: string
	totalEntries: number
	totalAllocation: number
	entries: IPortfolioViewEntry[]
}

export interface IPortfolioRebalanceAssetOpaque {
	ticker?: string
	allocation?: number
	lastIdea: CI.ITradeIdea
	prevIdeas?: CI.ITradeIdea[]
}

export interface IPortfolioRebalanceAsset
	extends IPortfolioRebalanceAssetOpaque {
	ticker: string
	allocation: number
	lastIdea: CI.ITradeIdea
	prevIdeas: CI.ITradeIdea[]
}

export interface IPortfolioRebalanceOpaque {
	strategyKey: string
	reference: string
	totalAssets: number
	totalAllocation?: number
	assets: IPortfolioRebalanceAssetOpaque[]
}

export interface IPortfolioRebalance extends IPortfolioRebalanceOpaque {
	strategyKey: string
	reference: string
	totalAssets: number
	totalAllocation: number
	assets: IPortfolioRebalanceAsset[]
}
