package com.ankurm.authdemo.auth;

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

/** Stand-in for the mainframe / proprietary API that actually holds some of your users. */
public interface LegacyDirectory {

    /** @throws DirectoryUnavailableException when the backend cannot be reached */
    Optional<LegacyUser> find(String username);

    record LegacyUser(String username, String passwordHash, List<String> roles, boolean locked) { }

    class DirectoryUnavailableException extends RuntimeException {
        public DirectoryUnavailableException(String message) {
            super(message);
        }
    }
}
