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

import com.qsoft.rs.sincoar.dto.TgenesegmentratePKDTO;
import com.qsoft.rs.sincoar.model.TgenesegmentratePK;
import java.math.BigDecimal;
import javax.annotation.processing.Generated;

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

    @Override
    public TgenesegmentratePK getEntidad(TgenesegmentratePKDTO tgenesegmentratePK) {
        if ( tgenesegmentratePK == null ) {
            return null;
        }

        TgenesegmentratePK tgenesegmentratePK1 = new TgenesegmentratePK();

        tgenesegmentratePK1.setInterestbalancetype( tgenesegmentratePK.getInterestbalancetype() );
        tgenesegmentratePK1.setInterestbalancegroup( tgenesegmentratePK.getInterestbalancegroup() );
        tgenesegmentratePK1.setCreditsegmentcatalog( tgenesegmentratePK.getCreditsegmentcatalog() );
        tgenesegmentratePK1.setCreditsegmentcatalogcode( tgenesegmentratePK.getCreditsegmentcatalogcode() );
        if ( tgenesegmentratePK.getCompanycode() != null ) {
            tgenesegmentratePK1.setCompanycode( tgenesegmentratePK.getCompanycode() );
        }
        tgenesegmentratePK1.setCurrencycode( tgenesegmentratePK.getCurrencycode() );
        if ( tgenesegmentratePK.getMinterm() != null ) {
            tgenesegmentratePK1.setMinterm( tgenesegmentratePK.getMinterm() );
        }
        if ( tgenesegmentratePK.getMinamount() != null ) {
            tgenesegmentratePK1.setMinamount( BigDecimal.valueOf( tgenesegmentratePK.getMinamount() ) );
        }

        return tgenesegmentratePK1;
    }

    @Override
    public TgenesegmentratePKDTO getDto(TgenesegmentratePK tgenesegmentratePK) {
        if ( tgenesegmentratePK == null ) {
            return null;
        }

        TgenesegmentratePKDTO tgenesegmentratePKDTO = new TgenesegmentratePKDTO();

        tgenesegmentratePKDTO.setInterestbalancetype( tgenesegmentratePK.getInterestbalancetype() );
        tgenesegmentratePKDTO.setInterestbalancegroup( tgenesegmentratePK.getInterestbalancegroup() );
        tgenesegmentratePKDTO.setCreditsegmentcatalog( tgenesegmentratePK.getCreditsegmentcatalog() );
        tgenesegmentratePKDTO.setCreditsegmentcatalogcode( tgenesegmentratePK.getCreditsegmentcatalogcode() );
        tgenesegmentratePKDTO.setCompanycode( (int) tgenesegmentratePK.getCompanycode() );
        tgenesegmentratePKDTO.setCurrencycode( tgenesegmentratePK.getCurrencycode() );
        tgenesegmentratePKDTO.setMinterm( tgenesegmentratePK.getMinterm() );
        if ( tgenesegmentratePK.getMinamount() != null ) {
            tgenesegmentratePKDTO.setMinamount( tgenesegmentratePK.getMinamount().intValue() );
        }

        return tgenesegmentratePKDTO;
    }
}
