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

import com.qsoft.rs.sincoar.dto.TarmarmasDTO;
import com.qsoft.rs.sincoar.model.Tarmarmas;
import com.qsoft.rs.sincoar.model.Tarmregistroarmas;
import com.qsoft.rs.sincoar.model.Tarmtipoarmaexplosivo;
import com.qsoft.rs.sincoar.model.Tgenecatalogdetail;
import com.qsoft.rs.sincoar.model.TgenecatalogdetailPK;
import com.qsoft.rs.sincoar.model.Tgenecity;
import com.qsoft.rs.sincoar.model.TgenecityPK;
import com.qsoft.rs.sincoar.model.Tgenecountry;
import com.qsoft.rs.sincoar.model.Tgeneparroquia;
import com.qsoft.rs.sincoar.model.TgeneparroquiaPK;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.annotation.processing.Generated;

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

    @Override
    public Tarmarmas getEntidad(TarmarmasDTO tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }

        Tarmarmas tarmarmas1 = new Tarmarmas();

        tarmarmas1.setCregistro( tarmarmasDTOToTarmregistroarmas( tarmarmas ) );
        tarmarmas1.setCtipoarmaexplosivo( tarmarmasDTOToTarmtipoarmaexplosivo( tarmarmas ) );
        tarmarmas1.setTgenecatalogdetail( tarmarmasDTOToTgenecatalogdetail( tarmarmas ) );
        tarmarmas1.setTgenecatalogdetail1( tarmarmasDTOToTgenecatalogdetail1( tarmarmas ) );
        tarmarmas1.setTgenecatalogdetail2( tarmarmasDTOToTgenecatalogdetail2( tarmarmas ) );
        tarmarmas1.setTgenecatalogdetail3( tarmarmasDTOToTgenecatalogdetail3( tarmarmas ) );
        tarmarmas1.setTgenecatalogdetail4( tarmarmasDTOToTgenecatalogdetail4( tarmarmas ) );
        tarmarmas1.setTgenecity( tarmarmasDTOToTgenecity( tarmarmas ) );
        tarmarmas1.setTgeneparroquia( tarmarmasDTOToTgeneparroquia( tarmarmas ) );
        tarmarmas1.setCpaisorigen( tarmarmasDTOToTgenecountry( tarmarmas ) );
        tarmarmas1.setCarma( tarmarmas.getCarma() );
        tarmarmas1.setLote( tarmarmas.getLote() );
        if ( tarmarmas.getCantidad() != null ) {
            tarmarmas1.setCantidad( BigDecimal.valueOf( tarmarmas.getCantidad() ) );
        }
        if ( tarmarmas.getPeso() != null ) {
            tarmarmas1.setPeso( BigDecimal.valueOf( tarmarmas.getPeso() ) );
        }
        tarmarmas1.setModelo( tarmarmas.getModelo() );
        tarmarmas1.setSeriecanon( tarmarmas.getSeriecanon() );
        tarmarmas1.setFemisionpermiso( tarmarmas.getFemisionpermiso() );
        tarmarmas1.setDireccion( tarmarmas.getDireccion() );
        tarmarmas1.setNemonicoarma( tarmarmas.getNemonicoarma() );
        tarmarmas1.setFecharegistro( tarmarmas.getFecharegistro() );
        if ( tarmarmas.getRecordversion() != null ) {
            tarmarmas1.setRecordversion( BigInteger.valueOf( tarmarmas.getRecordversion() ) );
        }
        tarmarmas1.setCodigoarma( tarmarmas.getCodigoarma() );
        tarmarmas1.setFdesaduanizacion( tarmarmas.getFdesaduanizacion() );
        tarmarmas1.setFechacaducidad( tarmarmas.getFechacaducidad() );
        tarmarmas1.setPartidaarancelaria( tarmarmas.getPartidaarancelaria() );
        tarmarmas1.setPartidaarancelariacodigo( tarmarmas.getPartidaarancelariacodigo() );
        tarmarmas1.setEstadodecomiso( tarmarmas.getEstadodecomiso() );
        tarmarmas1.setEstadoventa( tarmarmas.getEstadoventa() );
        tarmarmas1.setPathdocumento( tarmarmas.getPathdocumento() );
        tarmarmas1.setPathdocumentocrear( tarmarmas.getPathdocumentocrear() );
        tarmarmas1.setGeneracertificado( tarmarmas.getGeneracertificado() );

        return tarmarmas1;
    }

    @Override
    public TarmarmasDTO getDto(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }

        TarmarmasDTO tarmarmasDTO = new TarmarmasDTO();

        Long cregistro = tarmarmasCregistroCregistro( tarmarmas );
        if ( cregistro != null ) {
            tarmarmasDTO.setCregistro( String.valueOf( cregistro ) );
        }
        tarmarmasDTO.setCtipoarmaexplosivo( tarmarmasCtipoarmaexplosivoCtipoarmaexplosivo( tarmarmas ) );
        tarmarmasDTO.setTgenecatalogdetail( tarmarmasTgenecatalogdetailTgenecatalogdetailPKCatalog( tarmarmas ) );
        tarmarmasDTO.setTgenecatalogdetail1( tarmarmasTgenecatalogdetail1TgenecatalogdetailPKCatalog( tarmarmas ) );
        tarmarmasDTO.setTgenecatalogdetail2( tarmarmasTgenecatalogdetail2TgenecatalogdetailPKCatalog( tarmarmas ) );
        tarmarmasDTO.setTgenecatalogdetail3( tarmarmasTgenecatalogdetail3TgenecatalogdetailPKCatalog( tarmarmas ) );
        tarmarmasDTO.setTgenecatalogdetail4( tarmarmasTgenecatalogdetail4TgenecatalogdetailPKCatalog( tarmarmas ) );
        tarmarmasDTO.setTgenecity( tarmarmasTgenecityTgenecityPKCitycode( tarmarmas ) );
        tarmarmasDTO.setTgeneparroquia( tarmarmasTgeneparroquiaTgeneparroquiaPKParroquiacode( tarmarmas ) );
        tarmarmasDTO.setCpaisorigen( tarmarmasCpaisorigenCountrycode( tarmarmas ) );
        tarmarmasDTO.setCarma( tarmarmas.getCarma() );
        tarmarmasDTO.setLote( tarmarmas.getLote() );
        if ( tarmarmas.getCantidad() != null ) {
            tarmarmasDTO.setCantidad( tarmarmas.getCantidad().intValue() );
        }
        if ( tarmarmas.getPeso() != null ) {
            tarmarmasDTO.setPeso( tarmarmas.getPeso().intValue() );
        }
        tarmarmasDTO.setModelo( tarmarmas.getModelo() );
        tarmarmasDTO.setSeriecanon( tarmarmas.getSeriecanon() );
        tarmarmasDTO.setFemisionpermiso( tarmarmas.getFemisionpermiso() );
        tarmarmasDTO.setDireccion( tarmarmas.getDireccion() );
        tarmarmasDTO.setNemonicoarma( tarmarmas.getNemonicoarma() );
        tarmarmasDTO.setFecharegistro( tarmarmas.getFecharegistro() );
        if ( tarmarmas.getRecordversion() != null ) {
            tarmarmasDTO.setRecordversion( tarmarmas.getRecordversion().intValue() );
        }
        tarmarmasDTO.setCodigoarma( tarmarmas.getCodigoarma() );
        tarmarmasDTO.setFdesaduanizacion( tarmarmas.getFdesaduanizacion() );
        tarmarmasDTO.setFechacaducidad( tarmarmas.getFechacaducidad() );
        tarmarmasDTO.setPartidaarancelaria( tarmarmas.getPartidaarancelaria() );
        tarmarmasDTO.setPartidaarancelariacodigo( tarmarmas.getPartidaarancelariacodigo() );
        tarmarmasDTO.setEstadodecomiso( tarmarmas.getEstadodecomiso() );
        tarmarmasDTO.setEstadoventa( tarmarmas.getEstadoventa() );
        tarmarmasDTO.setPathdocumento( tarmarmas.getPathdocumento() );
        tarmarmasDTO.setPathdocumentocrear( tarmarmas.getPathdocumentocrear() );
        tarmarmasDTO.setGeneracertificado( tarmarmas.getGeneracertificado() );

        return tarmarmasDTO;
    }

    protected Tarmregistroarmas tarmarmasDTOToTarmregistroarmas(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tarmregistroarmas tarmregistroarmas = new Tarmregistroarmas();

        if ( tarmarmasDTO.getCregistro() != null ) {
            tarmregistroarmas.setCregistro( Long.parseLong( tarmarmasDTO.getCregistro() ) );
        }

        return tarmregistroarmas;
    }

    protected Tarmtipoarmaexplosivo tarmarmasDTOToTarmtipoarmaexplosivo(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tarmtipoarmaexplosivo tarmtipoarmaexplosivo = new Tarmtipoarmaexplosivo();

        tarmtipoarmaexplosivo.setCtipoarmaexplosivo( tarmarmasDTO.getCtipoarmaexplosivo() );

        return tarmtipoarmaexplosivo;
    }

    protected TgenecatalogdetailPK tarmarmasDTOToTgenecatalogdetailPK(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        TgenecatalogdetailPK tgenecatalogdetailPK = new TgenecatalogdetailPK();

        tgenecatalogdetailPK.setCatalog( tarmarmasDTO.getTgenecatalogdetail() );

        return tgenecatalogdetailPK;
    }

    protected Tgenecatalogdetail tarmarmasDTOToTgenecatalogdetail(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tgenecatalogdetail tgenecatalogdetail = new Tgenecatalogdetail();

        tgenecatalogdetail.setTgenecatalogdetailPK( tarmarmasDTOToTgenecatalogdetailPK( tarmarmasDTO ) );

        return tgenecatalogdetail;
    }

    protected TgenecatalogdetailPK tarmarmasDTOToTgenecatalogdetailPK1(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        TgenecatalogdetailPK tgenecatalogdetailPK = new TgenecatalogdetailPK();

        tgenecatalogdetailPK.setCatalog( tarmarmasDTO.getTgenecatalogdetail1() );

        return tgenecatalogdetailPK;
    }

    protected Tgenecatalogdetail tarmarmasDTOToTgenecatalogdetail1(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tgenecatalogdetail tgenecatalogdetail = new Tgenecatalogdetail();

        tgenecatalogdetail.setTgenecatalogdetailPK( tarmarmasDTOToTgenecatalogdetailPK1( tarmarmasDTO ) );

        return tgenecatalogdetail;
    }

    protected TgenecatalogdetailPK tarmarmasDTOToTgenecatalogdetailPK2(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        TgenecatalogdetailPK tgenecatalogdetailPK = new TgenecatalogdetailPK();

        tgenecatalogdetailPK.setCatalog( tarmarmasDTO.getTgenecatalogdetail2() );

        return tgenecatalogdetailPK;
    }

    protected Tgenecatalogdetail tarmarmasDTOToTgenecatalogdetail2(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tgenecatalogdetail tgenecatalogdetail = new Tgenecatalogdetail();

        tgenecatalogdetail.setTgenecatalogdetailPK( tarmarmasDTOToTgenecatalogdetailPK2( tarmarmasDTO ) );

        return tgenecatalogdetail;
    }

    protected TgenecatalogdetailPK tarmarmasDTOToTgenecatalogdetailPK3(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        TgenecatalogdetailPK tgenecatalogdetailPK = new TgenecatalogdetailPK();

        tgenecatalogdetailPK.setCatalog( tarmarmasDTO.getTgenecatalogdetail3() );

        return tgenecatalogdetailPK;
    }

    protected Tgenecatalogdetail tarmarmasDTOToTgenecatalogdetail3(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tgenecatalogdetail tgenecatalogdetail = new Tgenecatalogdetail();

        tgenecatalogdetail.setTgenecatalogdetailPK( tarmarmasDTOToTgenecatalogdetailPK3( tarmarmasDTO ) );

        return tgenecatalogdetail;
    }

    protected TgenecatalogdetailPK tarmarmasDTOToTgenecatalogdetailPK4(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        TgenecatalogdetailPK tgenecatalogdetailPK = new TgenecatalogdetailPK();

        tgenecatalogdetailPK.setCatalog( tarmarmasDTO.getTgenecatalogdetail4() );

        return tgenecatalogdetailPK;
    }

    protected Tgenecatalogdetail tarmarmasDTOToTgenecatalogdetail4(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tgenecatalogdetail tgenecatalogdetail = new Tgenecatalogdetail();

        tgenecatalogdetail.setTgenecatalogdetailPK( tarmarmasDTOToTgenecatalogdetailPK4( tarmarmasDTO ) );

        return tgenecatalogdetail;
    }

    protected TgenecityPK tarmarmasDTOToTgenecityPK(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        TgenecityPK tgenecityPK = new TgenecityPK();

        tgenecityPK.setCitycode( tarmarmasDTO.getTgenecity() );

        return tgenecityPK;
    }

    protected Tgenecity tarmarmasDTOToTgenecity(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tgenecity tgenecity = new Tgenecity();

        tgenecity.setTgenecityPK( tarmarmasDTOToTgenecityPK( tarmarmasDTO ) );

        return tgenecity;
    }

    protected TgeneparroquiaPK tarmarmasDTOToTgeneparroquiaPK(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        TgeneparroquiaPK tgeneparroquiaPK = new TgeneparroquiaPK();

        tgeneparroquiaPK.setParroquiacode( tarmarmasDTO.getTgeneparroquia() );

        return tgeneparroquiaPK;
    }

    protected Tgeneparroquia tarmarmasDTOToTgeneparroquia(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tgeneparroquia tgeneparroquia = new Tgeneparroquia();

        tgeneparroquia.setTgeneparroquiaPK( tarmarmasDTOToTgeneparroquiaPK( tarmarmasDTO ) );

        return tgeneparroquia;
    }

    protected Tgenecountry tarmarmasDTOToTgenecountry(TarmarmasDTO tarmarmasDTO) {
        if ( tarmarmasDTO == null ) {
            return null;
        }

        Tgenecountry tgenecountry = new Tgenecountry();

        tgenecountry.setCountrycode( tarmarmasDTO.getCpaisorigen() );

        return tgenecountry;
    }

    private Long tarmarmasCregistroCregistro(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tarmregistroarmas cregistro = tarmarmas.getCregistro();
        if ( cregistro == null ) {
            return null;
        }
        Long cregistro1 = cregistro.getCregistro();
        if ( cregistro1 == null ) {
            return null;
        }
        return cregistro1;
    }

    private String tarmarmasCtipoarmaexplosivoCtipoarmaexplosivo(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tarmtipoarmaexplosivo ctipoarmaexplosivo = tarmarmas.getCtipoarmaexplosivo();
        if ( ctipoarmaexplosivo == null ) {
            return null;
        }
        String ctipoarmaexplosivo1 = ctipoarmaexplosivo.getCtipoarmaexplosivo();
        if ( ctipoarmaexplosivo1 == null ) {
            return null;
        }
        return ctipoarmaexplosivo1;
    }

    private String tarmarmasTgenecatalogdetailTgenecatalogdetailPKCatalog(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tgenecatalogdetail tgenecatalogdetail = tarmarmas.getTgenecatalogdetail();
        if ( tgenecatalogdetail == null ) {
            return null;
        }
        TgenecatalogdetailPK tgenecatalogdetailPK = tgenecatalogdetail.getTgenecatalogdetailPK();
        if ( tgenecatalogdetailPK == null ) {
            return null;
        }
        String catalog = tgenecatalogdetailPK.getCatalog();
        if ( catalog == null ) {
            return null;
        }
        return catalog;
    }

    private String tarmarmasTgenecatalogdetail1TgenecatalogdetailPKCatalog(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tgenecatalogdetail tgenecatalogdetail1 = tarmarmas.getTgenecatalogdetail1();
        if ( tgenecatalogdetail1 == null ) {
            return null;
        }
        TgenecatalogdetailPK tgenecatalogdetailPK = tgenecatalogdetail1.getTgenecatalogdetailPK();
        if ( tgenecatalogdetailPK == null ) {
            return null;
        }
        String catalog = tgenecatalogdetailPK.getCatalog();
        if ( catalog == null ) {
            return null;
        }
        return catalog;
    }

    private String tarmarmasTgenecatalogdetail2TgenecatalogdetailPKCatalog(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tgenecatalogdetail tgenecatalogdetail2 = tarmarmas.getTgenecatalogdetail2();
        if ( tgenecatalogdetail2 == null ) {
            return null;
        }
        TgenecatalogdetailPK tgenecatalogdetailPK = tgenecatalogdetail2.getTgenecatalogdetailPK();
        if ( tgenecatalogdetailPK == null ) {
            return null;
        }
        String catalog = tgenecatalogdetailPK.getCatalog();
        if ( catalog == null ) {
            return null;
        }
        return catalog;
    }

    private String tarmarmasTgenecatalogdetail3TgenecatalogdetailPKCatalog(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tgenecatalogdetail tgenecatalogdetail3 = tarmarmas.getTgenecatalogdetail3();
        if ( tgenecatalogdetail3 == null ) {
            return null;
        }
        TgenecatalogdetailPK tgenecatalogdetailPK = tgenecatalogdetail3.getTgenecatalogdetailPK();
        if ( tgenecatalogdetailPK == null ) {
            return null;
        }
        String catalog = tgenecatalogdetailPK.getCatalog();
        if ( catalog == null ) {
            return null;
        }
        return catalog;
    }

    private String tarmarmasTgenecatalogdetail4TgenecatalogdetailPKCatalog(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tgenecatalogdetail tgenecatalogdetail4 = tarmarmas.getTgenecatalogdetail4();
        if ( tgenecatalogdetail4 == null ) {
            return null;
        }
        TgenecatalogdetailPK tgenecatalogdetailPK = tgenecatalogdetail4.getTgenecatalogdetailPK();
        if ( tgenecatalogdetailPK == null ) {
            return null;
        }
        String catalog = tgenecatalogdetailPK.getCatalog();
        if ( catalog == null ) {
            return null;
        }
        return catalog;
    }

    private String tarmarmasTgenecityTgenecityPKCitycode(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tgenecity tgenecity = tarmarmas.getTgenecity();
        if ( tgenecity == null ) {
            return null;
        }
        TgenecityPK tgenecityPK = tgenecity.getTgenecityPK();
        if ( tgenecityPK == null ) {
            return null;
        }
        String citycode = tgenecityPK.getCitycode();
        if ( citycode == null ) {
            return null;
        }
        return citycode;
    }

    private String tarmarmasTgeneparroquiaTgeneparroquiaPKParroquiacode(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tgeneparroquia tgeneparroquia = tarmarmas.getTgeneparroquia();
        if ( tgeneparroquia == null ) {
            return null;
        }
        TgeneparroquiaPK tgeneparroquiaPK = tgeneparroquia.getTgeneparroquiaPK();
        if ( tgeneparroquiaPK == null ) {
            return null;
        }
        String parroquiacode = tgeneparroquiaPK.getParroquiacode();
        if ( parroquiacode == null ) {
            return null;
        }
        return parroquiacode;
    }

    private String tarmarmasCpaisorigenCountrycode(Tarmarmas tarmarmas) {
        if ( tarmarmas == null ) {
            return null;
        }
        Tgenecountry cpaisorigen = tarmarmas.getCpaisorigen();
        if ( cpaisorigen == null ) {
            return null;
        }
        String countrycode = cpaisorigen.getCountrycode();
        if ( countrycode == null ) {
            return null;
        }
        return countrycode;
    }
}
