class BudgetDetailMapper {

    public BudgetDetailSearchContract toSearchContract(final BudgetDetailSearch budgetDetailSearch) {

        final BudgetDetailSearchContract contract = new BudgetDetailSearchContract();

        contract.setId(budgetDetailSearch.getId());
        contract.setBudgetGroup(
                budgetDetailSearch.getBudgetGroup() != null ? budgetDetailSearch.getBudgetGroup() : null);
        contract.setBudget(BudgetContract.builder()
                .id(budgetDetailSearch.getBudget() != null ? budgetDetailSearch.getBudget().getId() : null).build());
        contract.setOriginalAmount(budgetDetailSearch.getOriginalAmount());
        contract.setApprovedAmount(budgetDetailSearch.getApprovedAmount());
        contract.setBudgetAvailable(budgetDetailSearch.getBudgetAvailable());
        contract.setAnticipatoryAmount(budgetDetailSearch.getAnticipatoryAmount());
        contract.setUsingDepartment(
                budgetDetailSearch.getUsingDepartment() != null ? budgetDetailSearch.getUsingDepartment() : null);
        contract.setExecutingDepartment(budgetDetailSearch.getExecutingDepartment() != null
                ? budgetDetailSearch.getExecutingDepartment() : null);
        contract.setFunction(budgetDetailSearch.getFunction() != null ? budgetDetailSearch.getFunction() : null);
        contract.setScheme(budgetDetailSearch.getScheme() != null ? budgetDetailSearch.getScheme() : null);
        contract.setFund(budgetDetailSearch.getFund() != null ? budgetDetailSearch.getFund() : null);
        contract.setSubScheme(budgetDetailSearch.getSubScheme() != null ? budgetDetailSearch.getSubScheme() : null);
        contract.setFunctionary(
                budgetDetailSearch.getFunctionary() != null ? budgetDetailSearch.getFunctionary() : null);
        contract.setBoundary(budgetDetailSearch.getBoundary() != null ? budgetDetailSearch.getBoundary() : null);
        contract.setMaterializedPath(budgetDetailSearch.getMaterializedPath());
        contract.setDocumentNumber(budgetDetailSearch.getDocumentNumber());
        contract.setUniqueNo(budgetDetailSearch.getUniqueNo());
        contract.setPlanningPercent(budgetDetailSearch.getPlanningPercent());
        contract.setStatus(FinancialStatusContract.builder()
                .id(budgetDetailSearch.getStatus() != null ? budgetDetailSearch.getStatus().getId() : null).build());
        contract.setCreatedBy(budgetDetailSearch.getCreatedBy());
        contract.setCreatedDate(budgetDetailSearch.getCreatedDate());
        contract.setLastModifiedBy(budgetDetailSearch.getLastModifiedBy());
        contract.setLastModifiedDate(budgetDetailSearch.getLastModifiedDate());
        contract.setTenantId(budgetDetailSearch.getTenantId());
        contract.setPageSize(budgetDetailSearch.getPageSize());
        contract.setOffset(budgetDetailSearch.getOffset());

        return contract;
    }

}