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

import com.qsoft.rs.sincoar.dto.MdFileArtifactsDTO;
import com.qsoft.rs.sincoar.model.MdApplicationfiles;
import com.qsoft.rs.sincoar.model.MdFileArtifacts;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.annotation.processing.Generated;

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

    @Override
    public MdFileArtifacts getEntidad(MdFileArtifactsDTO mdFileArtifacts) {
        if ( mdFileArtifacts == null ) {
            return null;
        }

        MdFileArtifacts mdFileArtifacts1 = new MdFileArtifacts();

        mdFileArtifacts1.setApplicationfilesId( mdFileArtifactsDTOToMdApplicationfiles( mdFileArtifacts ) );
        if ( mdFileArtifacts.getId() != null ) {
            mdFileArtifacts1.setId( BigDecimal.valueOf( mdFileArtifacts.getId() ) );
        }
        mdFileArtifacts1.setPattern( mdFileArtifacts.getPattern() );
        mdFileArtifacts1.setStringFound( mdFileArtifacts.getStringFound() );
        mdFileArtifacts1.setStringReplaced( mdFileArtifacts.getStringReplaced() );
        mdFileArtifacts1.setType( mdFileArtifacts.getType() );
        mdFileArtifacts1.setStatus( mdFileArtifacts.getStatus() );
        if ( mdFileArtifacts.getLine() != null ) {
            mdFileArtifacts1.setLine( BigInteger.valueOf( mdFileArtifacts.getLine() ) );
        }
        if ( mdFileArtifacts.getPatternStart() != null ) {
            mdFileArtifacts1.setPatternStart( BigInteger.valueOf( mdFileArtifacts.getPatternStart() ) );
        }
        if ( mdFileArtifacts.getPatternEnd() != null ) {
            mdFileArtifacts1.setPatternEnd( BigInteger.valueOf( mdFileArtifacts.getPatternEnd() ) );
        }
        mdFileArtifacts1.setDueDate( mdFileArtifacts.getDueDate() );
        mdFileArtifacts1.setDbType( mdFileArtifacts.getDbType() );
        mdFileArtifacts1.setCodeType( mdFileArtifacts.getCodeType() );
        mdFileArtifacts1.setDescription( mdFileArtifacts.getDescription() );
        if ( mdFileArtifacts.getPriority() != null ) {
            mdFileArtifacts1.setPriority( BigInteger.valueOf( mdFileArtifacts.getPriority() ) );
        }
        mdFileArtifacts1.setSecurityGroupId( mdFileArtifacts.getSecurityGroupId() );
        mdFileArtifacts1.setCreatedOn( mdFileArtifacts.getCreatedOn() );
        mdFileArtifacts1.setCreatedBy( mdFileArtifacts.getCreatedBy() );
        mdFileArtifacts1.setLastUpdated( mdFileArtifacts.getLastUpdated() );
        mdFileArtifacts1.setLastUpdatedBy( mdFileArtifacts.getLastUpdatedBy() );

        validaNulos( mdFileArtifacts, mdFileArtifacts1 );

        return mdFileArtifacts1;
    }

    @Override
    public MdFileArtifactsDTO getDto(MdFileArtifacts mdFileArtifacts) {
        if ( mdFileArtifacts == null ) {
            return null;
        }

        MdFileArtifactsDTO mdFileArtifactsDTO = new MdFileArtifactsDTO();

        BigDecimal id = mdFileArtifactsApplicationfilesIdId( mdFileArtifacts );
        if ( id != null ) {
            mdFileArtifactsDTO.setApplicationfilesId( id.intValue() );
        }
        if ( mdFileArtifacts.getId() != null ) {
            mdFileArtifactsDTO.setId( mdFileArtifacts.getId().intValue() );
        }
        mdFileArtifactsDTO.setPattern( mdFileArtifacts.getPattern() );
        mdFileArtifactsDTO.setStringFound( mdFileArtifacts.getStringFound() );
        mdFileArtifactsDTO.setStringReplaced( mdFileArtifacts.getStringReplaced() );
        mdFileArtifactsDTO.setType( mdFileArtifacts.getType() );
        mdFileArtifactsDTO.setStatus( mdFileArtifacts.getStatus() );
        if ( mdFileArtifacts.getLine() != null ) {
            mdFileArtifactsDTO.setLine( mdFileArtifacts.getLine().intValue() );
        }
        if ( mdFileArtifacts.getPatternStart() != null ) {
            mdFileArtifactsDTO.setPatternStart( mdFileArtifacts.getPatternStart().intValue() );
        }
        if ( mdFileArtifacts.getPatternEnd() != null ) {
            mdFileArtifactsDTO.setPatternEnd( mdFileArtifacts.getPatternEnd().intValue() );
        }
        mdFileArtifactsDTO.setDueDate( mdFileArtifacts.getDueDate() );
        mdFileArtifactsDTO.setDbType( mdFileArtifacts.getDbType() );
        mdFileArtifactsDTO.setCodeType( mdFileArtifacts.getCodeType() );
        mdFileArtifactsDTO.setDescription( mdFileArtifacts.getDescription() );
        if ( mdFileArtifacts.getPriority() != null ) {
            mdFileArtifactsDTO.setPriority( mdFileArtifacts.getPriority().intValue() );
        }
        mdFileArtifactsDTO.setSecurityGroupId( mdFileArtifacts.getSecurityGroupId() );
        mdFileArtifactsDTO.setCreatedOn( mdFileArtifacts.getCreatedOn() );
        mdFileArtifactsDTO.setCreatedBy( mdFileArtifacts.getCreatedBy() );
        mdFileArtifactsDTO.setLastUpdated( mdFileArtifacts.getLastUpdated() );
        mdFileArtifactsDTO.setLastUpdatedBy( mdFileArtifacts.getLastUpdatedBy() );

        return mdFileArtifactsDTO;
    }

    protected MdApplicationfiles mdFileArtifactsDTOToMdApplicationfiles(MdFileArtifactsDTO mdFileArtifactsDTO) {
        if ( mdFileArtifactsDTO == null ) {
            return null;
        }

        MdApplicationfiles mdApplicationfiles = new MdApplicationfiles();

        if ( mdFileArtifactsDTO.getApplicationfilesId() != null ) {
            mdApplicationfiles.setId( BigDecimal.valueOf( mdFileArtifactsDTO.getApplicationfilesId() ) );
        }

        return mdApplicationfiles;
    }

    private BigDecimal mdFileArtifactsApplicationfilesIdId(MdFileArtifacts mdFileArtifacts) {
        if ( mdFileArtifacts == null ) {
            return null;
        }
        MdApplicationfiles applicationfilesId = mdFileArtifacts.getApplicationfilesId();
        if ( applicationfilesId == null ) {
            return null;
        }
        BigDecimal id = applicationfilesId.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }
}
