package de.effigenix.domain.usermanagement;

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

import java.util.List;
import java.util.Optional;

/**
 * Repository interface for User entity.
 * Domain Layer defines the contract, Infrastructure Layer implements it.
 */
public interface UserRepository {

    Result<RepositoryError, Optional<User>> findById(UserId id);

    Result<RepositoryError, Optional<User>> findByUsername(String username);

    Result<RepositoryError, Optional<User>> findByEmail(String email);

    Result<RepositoryError, List<User>> findByBranchId(String branchId);

    Result<RepositoryError, List<User>> findByStatus(UserStatus status);

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

    Result<RepositoryError, Void> save(User user);

    Result<RepositoryError, Void> delete(User user);

    Result<RepositoryError, Boolean> existsByUsername(String username);

    Result<RepositoryError, Boolean> existsByEmail(String email);
}
