class BudgetMapper {

    public BudgetSearchContract toSearchContract(final BudgetSearch budgetSearch) {

        final BudgetSearchContract contract = new BudgetSearchContract();

        contract.setId(budgetSearch.getId());
        contract.setName(budgetSearch.getName());
        contract.setFinancialYear(FinancialYearContract.builder()
                .id(budgetSearch.getFinancialYear() != null ? budgetSearch.getFinancialYear().getId() : null).build());
        contract.setEstimationType(budgetSearch.getEstimationType() != null
                ? EstimationTypeContract.valueOf(budgetSearch.getEstimationType().name()) : null);
        contract.setParent(BudgetContract.builder()
                .id(budgetSearch.getParent() != null ? budgetSearch.getParent().getId() : null).build());
        contract.setDescription(budgetSearch.getDescription());
        contract.setActive(budgetSearch.getActive());
        contract.setPrimaryBudget(budgetSearch.getPrimaryBudget());
        contract.setMaterializedPath(budgetSearch.getMaterializedPath());
        contract.setReferenceBudget(BudgetContract.builder()
                .id(budgetSearch.getReferenceBudget() != null ? budgetSearch.getReferenceBudget().getId() : null)
                .build());
        contract.setDocumentNumber(budgetSearch.getDocumentNumber());
        contract.setStatus(FinancialStatusContract.builder()
                .id(budgetSearch.getStatus() != null ? budgetSearch.getStatus().getId() : null).build());
        contract.setCreatedBy(budgetSearch.getCreatedBy());
        contract.setCreatedDate(budgetSearch.getCreatedDate());
        contract.setLastModifiedBy(budgetSearch.getLastModifiedBy());
        contract.setLastModifiedDate(budgetSearch.getLastModifiedDate());
        contract.setTenantId(budgetSearch.getTenantId());
        contract.setPageSize(budgetSearch.getPageSize());
        contract.setOffset(budgetSearch.getOffset());

        return contract;
    }

}