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

import com.qsoft.rs.sincoar.dto.MdMigrWeakdepDTO;
import com.qsoft.rs.sincoar.model.MdConnections;
import com.qsoft.rs.sincoar.model.MdMigrWeakdep;
import com.qsoft.rs.sincoar.model.MdSchemas;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.annotation.processing.Generated;

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

    @Override
    public MdMigrWeakdep getEntidad(MdMigrWeakdepDTO mdMigrWeakdep) {
        if ( mdMigrWeakdep == null ) {
            return null;
        }

        MdMigrWeakdep mdMigrWeakdep1 = new MdMigrWeakdep();

        mdMigrWeakdep1.setSchemaIdFk( mdMigrWeakdepDTOToMdSchemas( mdMigrWeakdep ) );
        mdMigrWeakdep1.setConnectionIdFk( mdMigrWeakdepDTOToMdConnections( mdMigrWeakdep ) );
        if ( mdMigrWeakdep.getId() != null ) {
            mdMigrWeakdep1.setId( BigDecimal.valueOf( mdMigrWeakdep.getId() ) );
        }
        if ( mdMigrWeakdep.getParentId() != null ) {
            mdMigrWeakdep1.setParentId( BigInteger.valueOf( mdMigrWeakdep.getParentId() ) );
        }
        mdMigrWeakdep1.setChildName( mdMigrWeakdep.getChildName() );
        mdMigrWeakdep1.setParentType( mdMigrWeakdep.getParentType() );
        mdMigrWeakdep1.setChildType( mdMigrWeakdep.getChildType() );
        if ( mdMigrWeakdep.getSecurityGroupId() != null ) {
            mdMigrWeakdep1.setSecurityGroupId( BigInteger.valueOf( mdMigrWeakdep.getSecurityGroupId() ) );
        }
        mdMigrWeakdep1.setCreatedOn( mdMigrWeakdep.getCreatedOn() );
        mdMigrWeakdep1.setCreatedBy( mdMigrWeakdep.getCreatedBy() );
        mdMigrWeakdep1.setLastUpdatedOn( mdMigrWeakdep.getLastUpdatedOn() );
        mdMigrWeakdep1.setLastUpdatedBy( mdMigrWeakdep.getLastUpdatedBy() );

        return mdMigrWeakdep1;
    }

    @Override
    public MdMigrWeakdepDTO getDto(MdMigrWeakdep mdMigrWeakdep) {
        if ( mdMigrWeakdep == null ) {
            return null;
        }

        MdMigrWeakdepDTO mdMigrWeakdepDTO = new MdMigrWeakdepDTO();

        BigDecimal id = mdMigrWeakdepSchemaIdFkId( mdMigrWeakdep );
        if ( id != null ) {
            mdMigrWeakdepDTO.setSchemaIdFk( id.intValue() );
        }
        BigDecimal id1 = mdMigrWeakdepConnectionIdFkId( mdMigrWeakdep );
        if ( id1 != null ) {
            mdMigrWeakdepDTO.setConnectionIdFk( id1.intValue() );
        }
        if ( mdMigrWeakdep.getId() != null ) {
            mdMigrWeakdepDTO.setId( mdMigrWeakdep.getId().intValue() );
        }
        if ( mdMigrWeakdep.getParentId() != null ) {
            mdMigrWeakdepDTO.setParentId( mdMigrWeakdep.getParentId().intValue() );
        }
        mdMigrWeakdepDTO.setChildName( mdMigrWeakdep.getChildName() );
        mdMigrWeakdepDTO.setParentType( mdMigrWeakdep.getParentType() );
        mdMigrWeakdepDTO.setChildType( mdMigrWeakdep.getChildType() );
        if ( mdMigrWeakdep.getSecurityGroupId() != null ) {
            mdMigrWeakdepDTO.setSecurityGroupId( mdMigrWeakdep.getSecurityGroupId().intValue() );
        }
        mdMigrWeakdepDTO.setCreatedOn( mdMigrWeakdep.getCreatedOn() );
        mdMigrWeakdepDTO.setCreatedBy( mdMigrWeakdep.getCreatedBy() );
        mdMigrWeakdepDTO.setLastUpdatedOn( mdMigrWeakdep.getLastUpdatedOn() );
        mdMigrWeakdepDTO.setLastUpdatedBy( mdMigrWeakdep.getLastUpdatedBy() );

        return mdMigrWeakdepDTO;
    }

    protected MdSchemas mdMigrWeakdepDTOToMdSchemas(MdMigrWeakdepDTO mdMigrWeakdepDTO) {
        if ( mdMigrWeakdepDTO == null ) {
            return null;
        }

        MdSchemas mdSchemas = new MdSchemas();

        if ( mdMigrWeakdepDTO.getSchemaIdFk() != null ) {
            mdSchemas.setId( BigDecimal.valueOf( mdMigrWeakdepDTO.getSchemaIdFk() ) );
        }

        return mdSchemas;
    }

    protected MdConnections mdMigrWeakdepDTOToMdConnections(MdMigrWeakdepDTO mdMigrWeakdepDTO) {
        if ( mdMigrWeakdepDTO == null ) {
            return null;
        }

        MdConnections mdConnections = new MdConnections();

        if ( mdMigrWeakdepDTO.getConnectionIdFk() != null ) {
            mdConnections.setId( BigDecimal.valueOf( mdMigrWeakdepDTO.getConnectionIdFk() ) );
        }

        return mdConnections;
    }

    private BigDecimal mdMigrWeakdepSchemaIdFkId(MdMigrWeakdep mdMigrWeakdep) {
        if ( mdMigrWeakdep == null ) {
            return null;
        }
        MdSchemas schemaIdFk = mdMigrWeakdep.getSchemaIdFk();
        if ( schemaIdFk == null ) {
            return null;
        }
        BigDecimal id = schemaIdFk.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }

    private BigDecimal mdMigrWeakdepConnectionIdFkId(MdMigrWeakdep mdMigrWeakdep) {
        if ( mdMigrWeakdep == null ) {
            return null;
        }
        MdConnections connectionIdFk = mdMigrWeakdep.getConnectionIdFk();
        if ( connectionIdFk == null ) {
            return null;
        }
        BigDecimal id = connectionIdFk.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }
}
