import { ICurrency } from '~src/models/market/currency'; export interface IValuation { id: number; date: Date | null; value: number | null; // sharePrice: number | null; // totalShares: number | null; // shares: number | null; ownershipPercentage: number | null; // holding: IHolding | null; // Todo: remove it. // holdingId: number | null; currency: ICurrency | null; status: IValuationStatus | null; } export enum IValuationStatus { confirmed, expected, cancelled, } export function parseValuation(valuation: IValuation): IValuation { valuation.id = +valuation.id; valuation.date = new Date(valuation.date); valuation.value = +valuation.value; // valuation.shares = +valuation.shares; // valuation.sharePrice = +valuation.sharePrice; // valuation.totalShares = +valuation.totalShares; valuation.ownershipPercentage = +valuation.ownershipPercentage; valuation.status = +valuation.status; return valuation; } export interface IValuationProperties { id?: boolean; date?: boolean; value?: boolean; // sharePrice?: boolean; // totalShares?: boolean; // shares?: boolean; ownershipPercentage?: boolean; currency?: boolean; status?: boolean; // holdingId?: boolean; } export interface IValuationPropertiesConfig { properties: IValuationProperties; relationProperties?: {}; } export function defaultValuationProperties(): IValuationProperties { return { id: true, date: true, value: true, // sharePrice: true, // totalShares: true, // shares: true, ownershipPercentage: true, currency: true, status: true, // holdingId: true, }; } export function defaultValuationPropertiesConfig(): IValuationPropertiesConfig { return { properties: defaultValuationProperties(), }; }