from __future__ import annotations

from dataclasses import dataclass
from datetime import date, datetime
from decimal import Decimal
from pathlib import Path


@dataclass(frozen=True)
class NormalizedTransaction:
    source_file: Path
    sheet_name: str
    source_row: int
    transaction_at: datetime
    income: Decimal
    expense: Decimal
    balance: Decimal | None
    own_account: str | None
    own_name: str | None
    counterparty_account: str | None
    counterparty_name: str | None
    counterparty_bank: str | None
    summary: str | None
    purpose: str | None
    reference: str | None
    currency: str | None


@dataclass(frozen=True)
class StatementBatch:
    source_file: Path
    sheet_name: str
    bank_name: str
    template_id: str
    header_row: int
    own_account: str | None
    own_name: str | None
    period_start: date | None
    period_end: date | None
    transactions: tuple[NormalizedTransaction, ...]
    warnings: tuple[str, ...]
    template_version: int = 1
