package de.effigenix.infrastructure.stub;

import de.effigenix.domain.production.Batch;
import de.effigenix.domain.production.BatchId;
import de.effigenix.domain.production.BatchNumber;
import de.effigenix.domain.production.BatchRepository;
import de.effigenix.domain.production.BatchStatus;
import de.effigenix.domain.production.RecipeId;
import de.effigenix.domain.production.TracedBatch;
import de.effigenix.shared.common.RepositoryError;
import de.effigenix.shared.common.Result;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Repository;

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

@Repository
@Profile("no-db")
public class StubBatchRepository implements BatchRepository {

    private static final RepositoryError.DatabaseError STUB_ERROR =
            new RepositoryError.DatabaseError("Stub-Modus: keine Datenbankverbindung");

    @Override
    public Result<RepositoryError, Optional<Batch>> findById(BatchId id) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<Batch>> findAll() {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, Optional<Batch>> findByBatchNumber(BatchNumber batchNumber) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<Batch>> findByStatus(BatchStatus status) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<Batch>> findByProductionDate(LocalDate date) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<Batch>> findByRecipeIds(List<RecipeId> recipeIds) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<Batch>> findAllSummary() {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<Batch>> findByStatusSummary(BatchStatus status) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<Batch>> findByProductionDateSummary(LocalDate date) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<Batch>> findByRecipeIdsSummary(List<RecipeId> recipeIds) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<Batch>> findByInputBatchId(BatchId inputBatchId) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<TracedBatch>> traceForward(BatchId startBatchId, int maxDepth) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<TracedBatch>> traceBackward(BatchId startBatchId, int maxDepth) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, Void> save(Batch batch) {
        return Result.failure(STUB_ERROR);
    }
}
