from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import List


@dataclass
class ParsedTransaction:
    operation_date: str  # ISO date or datetime
    debit_date: str | None
    amount: float  # signed: negative = expense
    amount_card_currency: float | None
    description: str
    card_tail: str  # last 4 digits for account matching


class BaseBankParser(ABC):
    @abstractmethod
    def can_parse(self, filename: str) -> bool:
        pass

    @abstractmethod
    def parse(self, file_path: str) -> List[ParsedTransaction]:
        pass
