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

import com.qsoft.rs.sincoar.dto.MdGroupMembersDTO;
import com.qsoft.rs.sincoar.model.MdGroupMembers;
import com.qsoft.rs.sincoar.model.MdGroups;
import com.qsoft.rs.sincoar.model.MdUsers;
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 MdGroupMembersMapperImpl implements MdGroupMembersMapper {

    @Override
    public MdGroupMembers getEntidad(MdGroupMembersDTO mdGroupMembers) {
        if ( mdGroupMembers == null ) {
            return null;
        }

        MdGroupMembers mdGroupMembers1 = new MdGroupMembers();

        mdGroupMembers1.setGroupIdFk( mdGroupMembersDTOToMdGroups( mdGroupMembers ) );
        mdGroupMembers1.setGroupMemberIdFk( mdGroupMembersDTOToMdGroups1( mdGroupMembers ) );
        mdGroupMembers1.setUserIdFk( mdGroupMembersDTOToMdUsers( mdGroupMembers ) );
        if ( mdGroupMembers.getId() != null ) {
            mdGroupMembers1.setId( BigDecimal.valueOf( mdGroupMembers.getId() ) );
        }
        if ( mdGroupMembers.getSecurityGroupId() != null ) {
            mdGroupMembers1.setSecurityGroupId( BigInteger.valueOf( mdGroupMembers.getSecurityGroupId() ) );
        }
        mdGroupMembers1.setCreatedOn( mdGroupMembers.getCreatedOn() );
        mdGroupMembers1.setCreatedBy( mdGroupMembers.getCreatedBy() );
        mdGroupMembers1.setLastUpdatedOn( mdGroupMembers.getLastUpdatedOn() );
        mdGroupMembers1.setLastUpdatedBy( mdGroupMembers.getLastUpdatedBy() );

        validaNulos( mdGroupMembers, mdGroupMembers1 );

        return mdGroupMembers1;
    }

    @Override
    public MdGroupMembersDTO getDto(MdGroupMembers mdGroupMembers) {
        if ( mdGroupMembers == null ) {
            return null;
        }

        MdGroupMembersDTO mdGroupMembersDTO = new MdGroupMembersDTO();

        BigDecimal id = mdGroupMembersGroupIdFkId( mdGroupMembers );
        if ( id != null ) {
            mdGroupMembersDTO.setGroupIdFk( id.intValue() );
        }
        BigDecimal id1 = mdGroupMembersGroupMemberIdFkId( mdGroupMembers );
        if ( id1 != null ) {
            mdGroupMembersDTO.setGroupMemberIdFk( id1.intValue() );
        }
        BigDecimal id2 = mdGroupMembersUserIdFkId( mdGroupMembers );
        if ( id2 != null ) {
            mdGroupMembersDTO.setUserIdFk( id2.intValue() );
        }
        if ( mdGroupMembers.getId() != null ) {
            mdGroupMembersDTO.setId( mdGroupMembers.getId().intValue() );
        }
        if ( mdGroupMembers.getSecurityGroupId() != null ) {
            mdGroupMembersDTO.setSecurityGroupId( mdGroupMembers.getSecurityGroupId().intValue() );
        }
        mdGroupMembersDTO.setCreatedOn( mdGroupMembers.getCreatedOn() );
        mdGroupMembersDTO.setCreatedBy( mdGroupMembers.getCreatedBy() );
        mdGroupMembersDTO.setLastUpdatedOn( mdGroupMembers.getLastUpdatedOn() );
        mdGroupMembersDTO.setLastUpdatedBy( mdGroupMembers.getLastUpdatedBy() );

        return mdGroupMembersDTO;
    }

    protected MdGroups mdGroupMembersDTOToMdGroups(MdGroupMembersDTO mdGroupMembersDTO) {
        if ( mdGroupMembersDTO == null ) {
            return null;
        }

        MdGroups mdGroups = new MdGroups();

        if ( mdGroupMembersDTO.getGroupIdFk() != null ) {
            mdGroups.setId( BigDecimal.valueOf( mdGroupMembersDTO.getGroupIdFk() ) );
        }

        return mdGroups;
    }

    protected MdGroups mdGroupMembersDTOToMdGroups1(MdGroupMembersDTO mdGroupMembersDTO) {
        if ( mdGroupMembersDTO == null ) {
            return null;
        }

        MdGroups mdGroups = new MdGroups();

        if ( mdGroupMembersDTO.getGroupMemberIdFk() != null ) {
            mdGroups.setId( BigDecimal.valueOf( mdGroupMembersDTO.getGroupMemberIdFk() ) );
        }

        return mdGroups;
    }

    protected MdUsers mdGroupMembersDTOToMdUsers(MdGroupMembersDTO mdGroupMembersDTO) {
        if ( mdGroupMembersDTO == null ) {
            return null;
        }

        MdUsers mdUsers = new MdUsers();

        if ( mdGroupMembersDTO.getUserIdFk() != null ) {
            mdUsers.setId( BigDecimal.valueOf( mdGroupMembersDTO.getUserIdFk() ) );
        }

        return mdUsers;
    }

    private BigDecimal mdGroupMembersGroupIdFkId(MdGroupMembers mdGroupMembers) {
        if ( mdGroupMembers == null ) {
            return null;
        }
        MdGroups groupIdFk = mdGroupMembers.getGroupIdFk();
        if ( groupIdFk == null ) {
            return null;
        }
        BigDecimal id = groupIdFk.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }

    private BigDecimal mdGroupMembersGroupMemberIdFkId(MdGroupMembers mdGroupMembers) {
        if ( mdGroupMembers == null ) {
            return null;
        }
        MdGroups groupMemberIdFk = mdGroupMembers.getGroupMemberIdFk();
        if ( groupMemberIdFk == null ) {
            return null;
        }
        BigDecimal id = groupMemberIdFk.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }

    private BigDecimal mdGroupMembersUserIdFkId(MdGroupMembers mdGroupMembers) {
        if ( mdGroupMembers == null ) {
            return null;
        }
        MdUsers userIdFk = mdGroupMembers.getUserIdFk();
        if ( userIdFk == null ) {
            return null;
        }
        BigDecimal id = userIdFk.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }
}
