Refactor a hypothetical repository containing unused methods and fields to improve code structure using design patterns like factory providers.
Asked in the Technical Screening stage. First part of a 60-minute technical assessment allocated 30 minutes.
Implement a refactoring pass over a repository model. Given classes, fields, methods, and provider mappings, remove unused members and replace direct construction with factory-based creation where applicable.
classes: list of class definitionsusage: list of method and field references that are actually usedproviders: mapping from class names to factory provider namesReturn the cleaned repository structure with unused members removed and object creation routed through providers when a mapping exists.
def refactor_repository(classes, usage, providers):