class ANCSmartRegisterController {

    public ANCClients getClients() {
        return ancClientsCache.get(ANC_CLIENTS_LIST, new CacheableData<ANCClients>() {
            @Override
            public ANCClients fetch() {
                ANCClients ancClients = new ANCClients();
                List<Pair<Mother, EligibleCouple>> ancsWithEcs = allBeneficiaries.allANCsWithEC();

                for (Pair<Mother, EligibleCouple> ancWithEc : ancsWithEcs) {
                    Mother anc = ancWithEc.getLeft();
                    EligibleCouple ec = ancWithEc.getRight();
                    String photoPath =
                            isBlank(ec.photoPath()) ? DEFAULT_WOMAN_IMAGE_PLACEHOLDER_PATH
                                    : ec.photoPath();

                    List<ServiceProvidedDTO> servicesProvided = getServicesProvided(anc.caseId());
                    List<AlertDTO> alerts = getAlerts(anc.caseId());
                    ANCClient ancClient = new ANCClient(anc.caseId(), ec.village(), ec.wifeName(),
                            anc.thayiCardNumber(),
                            anc.getDetail(AllConstants.ANCRegistrationFields.EDD),
                            anc.referenceDate()).withHusbandName(ec.husbandName()).withAge(ec.age())
                            .withECNumber(ec.ecNumber()).withANCNumber(
                                    anc.getDetail(AllConstants.ANCRegistrationFields.ANC_NUMBER))
                            .withIsHighPriority(ec.isHighPriority())
                            .withIsHighRisk(anc.isHighRisk()).withIsOutOfArea(ec.isOutOfArea())
                            .withHighRiskReason(anc.highRiskReason())
                            .withCaste(ec.getDetail(AllConstants.ECRegistrationFields.CASTE))
                            .withEconomicStatus(
                                    ec.getDetail(AllConstants.ECRegistrationFields.ECONOMIC_STATUS))
                            .withPhotoPath(photoPath).withEntityIdToSavePhoto(ec.caseId())
                            .withAlerts(alerts).withAshaPhoneNumber(anc.getDetail(
                                    AllConstants.ANCRegistrationFields.ASHA_PHONE_NUMBER))
                            .withServicesProvided(servicesProvided).withPreProcess();
                    ancClients.add(ancClient);
                }
                sortByName(ancClients);
                return ancClients;
            }
        });
    }

    public  ANCSmartRegisterController(ServiceProvidedService serviceProvidedService, AlertService
            alertService, AllBeneficiaries allBeneficiaries, Cache<String> cache,
                                      Cache<ANCClients> ancClientsCache);

}