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

import com.qsoft.rs.sincoar.dto.MigrDatatypeTransformMapDTO;
import com.qsoft.rs.sincoar.model.MdProjects;
import com.qsoft.rs.sincoar.model.MigrDatatypeTransformMap;
import java.math.BigDecimal;
import java.math.BigInteger;
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 MigrDatatypeTransformMapMapperImpl implements MigrDatatypeTransformMapMapper {

    @Override
    public MigrDatatypeTransformMap getEntidad(MigrDatatypeTransformMapDTO migrDatatypeTransformMap) {
        if ( migrDatatypeTransformMap == null ) {
            return null;
        }

        MigrDatatypeTransformMap migrDatatypeTransformMap1 = new MigrDatatypeTransformMap();

        migrDatatypeTransformMap1.setProjectIdFk( migrDatatypeTransformMapDTOToMdProjects( migrDatatypeTransformMap ) );
        if ( migrDatatypeTransformMap.getId() != null ) {
            migrDatatypeTransformMap1.setId( BigDecimal.valueOf( migrDatatypeTransformMap.getId() ) );
        }
        migrDatatypeTransformMap1.setMapName( migrDatatypeTransformMap.getMapName() );
        if ( migrDatatypeTransformMap.getSecurityGroupId() != null ) {
            migrDatatypeTransformMap1.setSecurityGroupId( BigInteger.valueOf( migrDatatypeTransformMap.getSecurityGroupId() ) );
        }
        migrDatatypeTransformMap1.setCreatedOn( migrDatatypeTransformMap.getCreatedOn() );
        migrDatatypeTransformMap1.setCreatedBy( migrDatatypeTransformMap.getCreatedBy() );
        migrDatatypeTransformMap1.setLastUpdatedOn( migrDatatypeTransformMap.getLastUpdatedOn() );
        migrDatatypeTransformMap1.setLastUpdatedBy( migrDatatypeTransformMap.getLastUpdatedBy() );

        return migrDatatypeTransformMap1;
    }

    @Override
    public MigrDatatypeTransformMapDTO getDto(MigrDatatypeTransformMap migrDatatypeTransformMap) {
        if ( migrDatatypeTransformMap == null ) {
            return null;
        }

        MigrDatatypeTransformMapDTO migrDatatypeTransformMapDTO = new MigrDatatypeTransformMapDTO();

        BigDecimal id = migrDatatypeTransformMapProjectIdFkId( migrDatatypeTransformMap );
        if ( id != null ) {
            migrDatatypeTransformMapDTO.setProjectIdFk( id.intValue() );
        }
        if ( migrDatatypeTransformMap.getId() != null ) {
            migrDatatypeTransformMapDTO.setId( migrDatatypeTransformMap.getId().intValue() );
        }
        migrDatatypeTransformMapDTO.setMapName( migrDatatypeTransformMap.getMapName() );
        if ( migrDatatypeTransformMap.getSecurityGroupId() != null ) {
            migrDatatypeTransformMapDTO.setSecurityGroupId( migrDatatypeTransformMap.getSecurityGroupId().intValue() );
        }
        migrDatatypeTransformMapDTO.setCreatedOn( migrDatatypeTransformMap.getCreatedOn() );
        migrDatatypeTransformMapDTO.setCreatedBy( migrDatatypeTransformMap.getCreatedBy() );
        migrDatatypeTransformMapDTO.setLastUpdatedOn( migrDatatypeTransformMap.getLastUpdatedOn() );
        migrDatatypeTransformMapDTO.setLastUpdatedBy( migrDatatypeTransformMap.getLastUpdatedBy() );

        return migrDatatypeTransformMapDTO;
    }

    protected MdProjects migrDatatypeTransformMapDTOToMdProjects(MigrDatatypeTransformMapDTO migrDatatypeTransformMapDTO) {
        if ( migrDatatypeTransformMapDTO == null ) {
            return null;
        }

        MdProjects mdProjects = new MdProjects();

        if ( migrDatatypeTransformMapDTO.getProjectIdFk() != null ) {
            mdProjects.setId( BigDecimal.valueOf( migrDatatypeTransformMapDTO.getProjectIdFk() ) );
        }

        return mdProjects;
    }

    private BigDecimal migrDatatypeTransformMapProjectIdFkId(MigrDatatypeTransformMap migrDatatypeTransformMap) {
        if ( migrDatatypeTransformMap == null ) {
            return null;
        }
        MdProjects projectIdFk = migrDatatypeTransformMap.getProjectIdFk();
        if ( projectIdFk == null ) {
            return null;
        }
        BigDecimal id = projectIdFk.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }
}
