class BudgetReAppropriationMapper {

    public BudgetReAppropriationContract toContract(final BudgetReAppropriation budgetReAppropriation) {

        final BudgetReAppropriationContract contract = new BudgetReAppropriationContract();

        contract.setId(budgetReAppropriation.getId());
        if (budgetReAppropriation.getBudgetDetail() != null) {
            final BudgetDetailMapper bdMapper = new BudgetDetailMapper();
            contract.setBudgetDetail(bdMapper.toContract(budgetReAppropriation.getBudgetDetail()));
        }
        contract.setAdditionAmount(budgetReAppropriation.getAdditionAmount());
        contract.setDeductionAmount(budgetReAppropriation.getDeductionAmount());
        contract.setOriginalAdditionAmount(budgetReAppropriation.getOriginalAdditionAmount());
        contract.setOriginalDeductionAmount(budgetReAppropriation.getOriginalDeductionAmount());
        contract.setAnticipatoryAmount(budgetReAppropriation.getAnticipatoryAmount());
        if (budgetReAppropriation.getStatus() != null)
            contract.setStatus(FinancialStatusContract.builder().id(budgetReAppropriation.getStatus().getId())
                    .code(budgetReAppropriation.getStatus().getCode())
                    .description(budgetReAppropriation.getStatus().getDescription())
                    .moduleType(budgetReAppropriation.getStatus().getModuleType()).build());
        contract.setAsOnDate(budgetReAppropriation.getAsOnDate());
        contract.setCreatedBy(budgetReAppropriation.getCreatedBy());
        contract.setCreatedDate(budgetReAppropriation.getCreatedDate());
        contract.setLastModifiedBy(budgetReAppropriation.getLastModifiedBy());
        contract.setLastModifiedDate(budgetReAppropriation.getLastModifiedDate());
        contract.setTenantId(budgetReAppropriation.getTenantId());

        return contract;
    }

}