package de.effigenix.domain.production;

import de.effigenix.shared.common.RepositoryError;
import de.effigenix.shared.common.Result;

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

public interface BatchRepository {

    Result<RepositoryError, Optional<Batch>> findById(BatchId id);

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

    Result<RepositoryError, Optional<Batch>> findByBatchNumber(BatchNumber batchNumber);

    Result<RepositoryError, List<Batch>> findByStatus(BatchStatus status);

    Result<RepositoryError, List<Batch>> findByProductionDate(LocalDate date);

    Result<RepositoryError, List<Batch>> findByRecipeIds(List<RecipeId> recipeIds);

    Result<RepositoryError, List<Batch>> findAllSummary();

    Result<RepositoryError, List<Batch>> findByStatusSummary(BatchStatus status);

    Result<RepositoryError, List<Batch>> findByProductionDateSummary(LocalDate date);

    Result<RepositoryError, List<Batch>> findByRecipeIdsSummary(List<RecipeId> recipeIds);

    Result<RepositoryError, List<Batch>> findByInputBatchId(BatchId inputBatchId);

    Result<RepositoryError, List<TracedBatch>> traceForward(BatchId startBatchId, int maxDepth);

    Result<RepositoryError, List<TracedBatch>> traceBackward(BatchId startBatchId, int maxDepth);

    Result<RepositoryError, Void> save(Batch batch);
}
