package com.qsoft.rs.sincoar.dominio.mapper;

import com.qsoft.rs.sincoar.dto.TgenecurrencyDTO;
import com.qsoft.rs.sincoar.model.Tgenecurrency;
import java.math.BigInteger;
import javax.annotation.processing.Generated;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2022-09-02T16:14:50-0500",
    comments = "version: 1.5.2.Final, compiler: javac, environment: Java 17.0.4 (Private Build)"
)
public class TgenecurrencyMapperImpl implements TgenecurrencyMapper {

    @Override
    public Tgenecurrency getEntidad(TgenecurrencyDTO tgenecurrency) {
        if ( tgenecurrency == null ) {
            return null;
        }

        Tgenecurrency tgenecurrency1 = new Tgenecurrency();

        tgenecurrency1.setCurrencycode( tgenecurrency.getCurrencycode() );
        if ( tgenecurrency.getRecordversion() != null ) {
            tgenecurrency1.setRecordversion( BigInteger.valueOf( tgenecurrency.getRecordversion() ) );
        }
        if ( tgenecurrency.getPresision() != null ) {
            tgenecurrency1.setPresision( tgenecurrency.getPresision().shortValue() );
        }
        tgenecurrency1.setDescription( tgenecurrency.getDescription() );

        return tgenecurrency1;
    }

    @Override
    public TgenecurrencyDTO getDto(Tgenecurrency tgenecurrency) {
        if ( tgenecurrency == null ) {
            return null;
        }

        TgenecurrencyDTO tgenecurrencyDTO = new TgenecurrencyDTO();

        tgenecurrencyDTO.setCurrencycode( tgenecurrency.getCurrencycode() );
        if ( tgenecurrency.getRecordversion() != null ) {
            tgenecurrencyDTO.setRecordversion( tgenecurrency.getRecordversion().intValue() );
        }
        tgenecurrencyDTO.setPresision( (int) tgenecurrency.getPresision() );
        tgenecurrencyDTO.setDescription( tgenecurrency.getDescription() );

        return tgenecurrencyDTO;
    }
}
