package com.andrewlalis.perfin.data;

import com.andrewlalis.perfin.model.Attachment;
import com.andrewlalis.perfin.model.BalanceRecord;
import com.andrewlalis.perfin.model.BalanceRecordType;

import java.math.BigDecimal;
import java.nio.file.Path;
import java.time.LocalDateTime;
import java.util.Currency;
import java.util.List;
import java.util.Optional;

public interface BalanceRecordRepository extends Repository, AutoCloseable {
    long insert(LocalDateTime utcTimestamp, long accountId, BalanceRecordType type, BigDecimal balance, Currency currency, List<Path> attachments);
    BalanceRecord findLatestByAccountId(long accountId, BalanceRecordType type);
    Optional<BalanceRecord> findById(long id);
    Optional<BalanceRecord> findClosestBefore(long accountId, BalanceRecordType type, LocalDateTime utcTimestamp);
    Optional<BalanceRecord> findClosestAfter(long accountId, BalanceRecordType type, LocalDateTime utcTimestamp);
    List<Attachment> findAttachments(long recordId);
    void deleteById(long id);
}
