"""
Cash flow statement canonical concepts.

Ordered following the standard cash flow statement layout:
Operating → Investing → Financing → Net Change.
"""

from .concepts import CanonicalConcept

CASH_FLOW_CONCEPTS = (
  # ── Operating Activities ─────────────────────────────────────────────
  CanonicalConcept(
    id="operating_cash_flow",
    display_name="Operating Cash Flow",
    category="cash_flow",
    description="Net cash from operating activities",
    aliases=("cash from operations", "cfo"),
    expected_elements=(
      "us-gaap:NetCashProvidedByUsedInOperatingActivities",
      "us-gaap:NetCashProvidedByUsedInOperatingActivitiesContinuingOperations",
    ),
    period_type="duration",
    balance="debit",
  ),
  # ── Investing Activities ─────────────────────────────────────────────
  CanonicalConcept(
    id="capital_expenditures",
    display_name="Capital Expenditures",
    category="cash_flow",
    description="Cash spent on property, plant and equipment purchases",
    aliases=("capex", "purchases of property and equipment"),
    expected_elements=(
      "us-gaap:PaymentsToAcquirePropertyPlantAndEquipment",
      "us-gaap:PaymentsToAcquireProductiveAssets",
    ),
    period_type="duration",
    balance="credit",
  ),
  CanonicalConcept(
    id="investing_cash_flow",
    display_name="Investing Cash Flow",
    category="cash_flow",
    description="Net cash from investing activities",
    aliases=("cash from investing",),
    expected_elements=("us-gaap:NetCashProvidedByUsedInInvestingActivities",),
    period_type="duration",
    balance="debit",
  ),
  # ── Financing Activities ─────────────────────────────────────────────
  CanonicalConcept(
    id="dividends_paid",
    display_name="Dividends Paid",
    category="cash_flow",
    description="Total dividends paid to stockholders",
    aliases=("dividend payments",),
    expected_elements=(
      "us-gaap:PaymentsOfDividends",
      "us-gaap:PaymentsOfDividendsCommonStock",
    ),
    period_type="duration",
    balance="credit",
  ),
  CanonicalConcept(
    id="share_repurchases",
    display_name="Share Repurchases",
    category="cash_flow",
    description="Cash spent on repurchasing company stock",
    aliases=("stock buybacks", "treasury stock purchases"),
    expected_elements=(
      "us-gaap:PaymentsForRepurchaseOfCommonStock",
      "us-gaap:PaymentsForRepurchaseOfEquity",
    ),
    period_type="duration",
    balance="credit",
  ),
  CanonicalConcept(
    id="financing_cash_flow",
    display_name="Financing Cash Flow",
    category="cash_flow",
    description="Net cash from financing activities",
    aliases=("cash from financing",),
    expected_elements=(
      "us-gaap:NetCashProvidedByUsedInFinancingActivities",
      "us-gaap:RepaymentsOfLongTermDebt",
      "us-gaap:ProceedsFromIssuanceOfLongTermDebt",
      "us-gaap:ProceedsFromRepaymentsOfShortTermDebtMaturingInMoreThanThreeMonths",
    ),
    period_type="duration",
    balance="debit",
  ),
  # ── Net Change ───────────────────────────────────────────────────────
  CanonicalConcept(
    id="net_change_in_cash",
    display_name="Net Change in Cash",
    category="cash_flow",
    description="Net increase or decrease in cash, cash equivalents, and restricted cash during the period",
    aliases=(
      "change in cash",
      "net increase in cash",
      "cash period increase decrease",
    ),
    expected_elements=(
      "us-gaap:CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect",
      "us-gaap:CashAndCashEquivalentsPeriodIncreaseDecrease",
      "us-gaap:CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseExcludingExchangeRateEffect",
    ),
    period_type="duration",
    balance="debit",
  ),
)
