/**
 * Financial Statements Types
 * Types for fundamental financial statement data
 */

/**
 * Balance Sheet data structure
 */
export interface BalanceSheet {
  /** Reporting period date */
  date: string;
  /** Fiscal period (Q1, Q2, Q3, Q4, FY) */
  period: string;
  /** Currency */
  currency: string;

  // Assets
  /** Total current assets */
  totalCurrentAssets: number;
  /** Cash and cash equivalents */
  cashAndEquivalents: number;
  /** Short-term investments */
  shortTermInvestments?: number;
  /** Accounts receivable */
  accountsReceivable: number;
  /** Inventory */
  inventory: number;
  /** Prepaid expenses */
  prepaidExpenses?: number;
  /** Other current assets */
  otherCurrentAssets?: number;

  /** Total non-current assets */
  totalNonCurrentAssets: number;
  /** Property, plant & equipment (net) */
  propertyPlantEquipmentNet: number;
  /** Intangible assets */
  intangibleAssets?: number;
  /** Goodwill */
  goodwill?: number;
  /** Long-term investments */
  longTermInvestments?: number;
  /** Other non-current assets */
  otherNonCurrentAssets?: number;

  /** Total assets */
  totalAssets: number;

  // Liabilities
  /** Total current liabilities */
  totalCurrentLiabilities: number;
  /** Accounts payable */
  accountsPayable: number;
  /** Short-term debt */
  shortTermDebt: number;
  /** Accrued liabilities */
  accruedLiabilities?: number;
  /** Other current liabilities */
  otherCurrentLiabilities?: number;

  /** Total non-current liabilities */
  totalNonCurrentLiabilities: number;
  /** Long-term debt */
  longTermDebt: number;
  /** Deferred tax liabilities */
  deferredTaxLiabilities?: number;
  /** Other non-current liabilities */
  otherNonCurrentLiabilities?: number;

  /** Total liabilities */
  totalLiabilities: number;

  // Equity
  /** Total stockholders' equity */
  totalStockholdersEquity: number;
  /** Common stock */
  commonStock: number;
  /** Retained earnings */
  retainedEarnings: number;
  /** Additional paid-in capital */
  additionalPaidInCapital?: number;
  /** Treasury stock */
  treasuryStock?: number;
  /** Accumulated other comprehensive income */
  accumulatedOtherComprehensiveIncome?: number;
}

/**
 * Income Statement data structure
 */
export interface IncomeStatement {
  /** Reporting period date */
  date: string;
  /** Fiscal period (Q1, Q2, Q3, Q4, FY) */
  period: string;
  /** Currency */
  currency: string;

  /** Total revenue/net sales */
  totalRevenue: number;
  /** Cost of goods sold */
  costOfGoodsSold: number;
  /** Gross profit */
  grossProfit: number;

  /** Operating expenses */
  operatingExpenses: number;
  /** Research and development */
  researchAndDevelopment?: number;
  /** Selling, general & administrative */
  sellingGeneralAdministrative?: number;
  /** Depreciation and amortization */
  depreciationAmortization?: number;
  /** Other operating expenses */
  otherOperatingExpenses?: number;

  /** Operating income */
  operatingIncome: number;

  /** Interest income */
  interestIncome?: number;
  /** Interest expense */
  interestExpense?: number;
  /** Other income/expense */
  otherIncomeExpense?: number;

  /** Income before taxes */
  incomeBeforeTaxes: number;
  /** Income tax expense */
  incomeTaxExpense: number;
  /** Net income */
  netIncome: number;

  /** Earnings per share (basic) */
  earningsPerShareBasic: number;
  /** Earnings per share (diluted) */
  earningsPerShareDiluted: number;
  /** Weighted average shares outstanding (basic) */
  sharesOutstandingBasic: number;
  /** Weighted average shares outstanding (diluted) */
  sharesOutstandingDiluted: number;
}

/**
 * Cash Flow Statement data structure
 */
export interface CashFlowStatement {
  /** Reporting period date */
  date: string;
  /** Fiscal period (Q1, Q2, Q3, Q4, FY) */
  period: string;
  /** Currency */
  currency: string;

  // Operating Activities
  /** Net income */
  netIncome: number;
  /** Depreciation and amortization */
  depreciationAmortization: number;
  /** Changes in working capital */
  changesInWorkingCapital: number;
  /** Other operating activities */
  otherOperatingActivities?: number;
  /** Net cash from operating activities */
  netCashFromOperatingActivities: number;

  // Investing Activities
  /** Capital expenditures */
  capitalExpenditures: number;
  /** Acquisitions */
  acquisitions?: number;
  /** Investments */
  investments?: number;
  /** Other investing activities */
  otherInvestingActivities?: number;
  /** Net cash from investing activities */
  netCashFromInvestingActivities: number;

  // Financing Activities
  /** Debt issuance/repayment */
  debtIssuanceRepayment?: number;
  /** Equity issuance/repurchase */
  equityIssuanceRepurchase?: number;
  /** Dividends paid */
  dividendsPaid?: number;
  /** Other financing activities */
  otherFinancingActivities?: number;
  /** Net cash from financing activities */
  netCashFromFinancingActivities: number;

  /** Net change in cash */
  netChangeInCash: number;
  /** Cash at beginning of period */
  cashAtBeginningOfPeriod: number;
  /** Cash at end of period */
  cashAtEndOfPeriod: number;
}
