package de.effigenix.infrastructure.stub;

import de.effigenix.domain.inventory.InventoryCount;
import de.effigenix.domain.inventory.InventoryCountId;
import de.effigenix.domain.inventory.InventoryCountRepository;
import de.effigenix.domain.inventory.InventoryCountStatus;
import de.effigenix.domain.inventory.StorageLocationId;
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.util.List;
import java.util.Optional;

@Repository
@Profile("no-db")
public class StubInventoryCountRepository implements InventoryCountRepository {

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

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

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

    @Override
    public Result<RepositoryError, List<InventoryCount>> findByStorageLocationId(StorageLocationId storageLocationId) {
        return Result.failure(STUB_ERROR);
    }

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

    @Override
    public Result<RepositoryError, Boolean> existsActiveByStorageLocationId(StorageLocationId storageLocationId) {
        return Result.failure(STUB_ERROR);
    }

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