package de.effigenix.domain.inventory;

import de.effigenix.domain.masterdata.article.ArticleId;
import de.effigenix.shared.common.RepositoryError;
import de.effigenix.shared.common.Result;

import java.time.Instant;
import java.util.List;
import java.util.Optional;

public interface StockMovementRepository {

    Result<RepositoryError, Optional<StockMovement>> findById(StockMovementId id);

    Result<RepositoryError, List<StockMovement>> findAll();

    Result<RepositoryError, List<StockMovement>> findAllByStockId(StockId stockId);

    Result<RepositoryError, List<StockMovement>> findAllByArticleId(ArticleId articleId);

    Result<RepositoryError, List<StockMovement>> findAllByMovementType(MovementType movementType);

    Result<RepositoryError, List<StockMovement>> findAllByBatchReference(String batchReference);

    Result<RepositoryError, List<StockMovement>> findAllByPerformedAtBetween(Instant from, Instant to);

    Result<RepositoryError, List<StockMovement>> findAllByPerformedAtAfter(Instant from);

    Result<RepositoryError, List<StockMovement>> findAllByPerformedAtBefore(Instant to);

    Result<RepositoryError, Void> save(StockMovement stockMovement);
}
