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

import com.qsoft.rs.sincoar.dto.MdApplicationfilesDTO;
import com.qsoft.rs.sincoar.model.MdApplicationfiles;
import com.qsoft.rs.sincoar.model.MdApplications;
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 MdApplicationfilesMapperImpl implements MdApplicationfilesMapper {

    @Override
    public MdApplicationfiles getEntidad(MdApplicationfilesDTO mdApplicationfiles) {
        if ( mdApplicationfiles == null ) {
            return null;
        }

        MdApplicationfiles mdApplicationfiles1 = new MdApplicationfiles();

        mdApplicationfiles1.setApplicationsIdFk( mdApplicationfilesDTOToMdApplications( mdApplicationfiles ) );
        if ( mdApplicationfiles.getId() != null ) {
            mdApplicationfiles1.setId( BigDecimal.valueOf( mdApplicationfiles.getId() ) );
        }
        mdApplicationfiles1.setName( mdApplicationfiles.getName() );
        mdApplicationfiles1.setUri( mdApplicationfiles.getUri() );
        mdApplicationfiles1.setType( mdApplicationfiles.getType() );
        mdApplicationfiles1.setState( mdApplicationfiles.getState() );
        mdApplicationfiles1.setLanguage( mdApplicationfiles.getLanguage() );
        if ( mdApplicationfiles.getLoc() != null ) {
            mdApplicationfiles1.setLoc( BigInteger.valueOf( mdApplicationfiles.getLoc() ) );
        }
        if ( mdApplicationfiles.getSecurityGroupId() != null ) {
            mdApplicationfiles1.setSecurityGroupId( BigInteger.valueOf( mdApplicationfiles.getSecurityGroupId() ) );
        }
        mdApplicationfiles1.setCreatedOn( mdApplicationfiles.getCreatedOn() );
        mdApplicationfiles1.setCreatedBy( mdApplicationfiles.getCreatedBy() );
        mdApplicationfiles1.setUpdatedOn( mdApplicationfiles.getUpdatedOn() );
        mdApplicationfiles1.setUpdatedBy( mdApplicationfiles.getUpdatedBy() );

        validaNulos( mdApplicationfiles, mdApplicationfiles1 );

        return mdApplicationfiles1;
    }

    @Override
    public MdApplicationfilesDTO getDto(MdApplicationfiles mdApplicationfiles) {
        if ( mdApplicationfiles == null ) {
            return null;
        }

        MdApplicationfilesDTO mdApplicationfilesDTO = new MdApplicationfilesDTO();

        BigDecimal id = mdApplicationfilesApplicationsIdFkId( mdApplicationfiles );
        if ( id != null ) {
            mdApplicationfilesDTO.setApplicationsIdFk( id.intValue() );
        }
        if ( mdApplicationfiles.getId() != null ) {
            mdApplicationfilesDTO.setId( mdApplicationfiles.getId().intValue() );
        }
        mdApplicationfilesDTO.setName( mdApplicationfiles.getName() );
        mdApplicationfilesDTO.setUri( mdApplicationfiles.getUri() );
        mdApplicationfilesDTO.setType( mdApplicationfiles.getType() );
        mdApplicationfilesDTO.setState( mdApplicationfiles.getState() );
        mdApplicationfilesDTO.setLanguage( mdApplicationfiles.getLanguage() );
        if ( mdApplicationfiles.getLoc() != null ) {
            mdApplicationfilesDTO.setLoc( mdApplicationfiles.getLoc().intValue() );
        }
        if ( mdApplicationfiles.getSecurityGroupId() != null ) {
            mdApplicationfilesDTO.setSecurityGroupId( mdApplicationfiles.getSecurityGroupId().intValue() );
        }
        mdApplicationfilesDTO.setCreatedOn( mdApplicationfiles.getCreatedOn() );
        mdApplicationfilesDTO.setCreatedBy( mdApplicationfiles.getCreatedBy() );
        mdApplicationfilesDTO.setUpdatedOn( mdApplicationfiles.getUpdatedOn() );
        mdApplicationfilesDTO.setUpdatedBy( mdApplicationfiles.getUpdatedBy() );

        return mdApplicationfilesDTO;
    }

    protected MdApplications mdApplicationfilesDTOToMdApplications(MdApplicationfilesDTO mdApplicationfilesDTO) {
        if ( mdApplicationfilesDTO == null ) {
            return null;
        }

        MdApplications mdApplications = new MdApplications();

        if ( mdApplicationfilesDTO.getApplicationsIdFk() != null ) {
            mdApplications.setId( BigDecimal.valueOf( mdApplicationfilesDTO.getApplicationsIdFk() ) );
        }

        return mdApplications;
    }

    private BigDecimal mdApplicationfilesApplicationsIdFkId(MdApplicationfiles mdApplicationfiles) {
        if ( mdApplicationfiles == null ) {
            return null;
        }
        MdApplications applicationsIdFk = mdApplicationfiles.getApplicationsIdFk();
        if ( applicationsIdFk == null ) {
            return null;
        }
        BigDecimal id = applicationsIdFk.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }
}
