package de.effigenix.infrastructure.stub;

import de.effigenix.domain.inventory.MovementType;
import de.effigenix.domain.inventory.StockId;
import de.effigenix.domain.inventory.StockMovement;
import de.effigenix.domain.inventory.StockMovementId;
import de.effigenix.domain.inventory.StockMovementRepository;
import de.effigenix.domain.masterdata.article.ArticleId;
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.Instant;
import java.util.List;
import java.util.Optional;

@Repository
@Profile("no-db")
public class StubStockMovementRepository implements StockMovementRepository {

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

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

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

    @Override
    public Result<RepositoryError, List<StockMovement>> findAllByStockId(StockId stockId) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<StockMovement>> findAllByArticleId(ArticleId articleId) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<StockMovement>> findAllByMovementType(MovementType movementType) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<StockMovement>> findAllByBatchReference(String batchReference) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<StockMovement>> findAllByPerformedAtBetween(Instant from, Instant to) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<StockMovement>> findAllByPerformedAtAfter(Instant from) {
        return Result.failure(STUB_ERROR);
    }

    @Override
    public Result<RepositoryError, List<StockMovement>> findAllByPerformedAtBefore(Instant to) {
        return Result.failure(STUB_ERROR);
    }

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