class BudgetMapper {

    public Budget toDomain(final BudgetContract contract) {

        final Budget budget = new Budget();

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

        return budget;
    }

}