package fr.marouse.mapper;

import fr.marouse.dto.OperationDTO;
import fr.marouse.entity.Operation;

public class OperationMapper {

    public static OperationDTO toDTO(Operation entity) {
        if (entity == null) return null;

        OperationDTO dto = new OperationDTO();
        dto.setNumOperation(entity.getNumOperation());
        dto.setDateOperation(entity.getDateOperation());
        dto.setTypeOperation(entity.getTypeOperation());
        dto.setMontant(entity.getMontant());
        return dto;
    }

    public static Operation toEntity(OperationDTO dto) {
        if (dto == null) return null;

        Operation entity = new Operation();
        entity.setDateOperation(dto.getDateOperation());
        entity.setTypeOperation(dto.getTypeOperation());
        entity.setMontant(dto.getMontant());
        entity.setNumOperation(dto.getNumOperation());
        return entity;
    }
}

