package com.ankaibei.workFlow.common.online.model;

import com.ankaibei.workFlow.common.online.model.OnlineRule.OnlineRuleModelMapper;
import com.ankaibei.workFlow.common.online.vo.OnlineRuleVo;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2023-05-08T14:15:47+0800",
    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_144 (Oracle Corporation)"
)
public class OnlineRule$OnlineRuleModelMapperImpl implements OnlineRuleModelMapper {

    @Override
    public List<OnlineRuleVo> fromModelList(List<OnlineRule> arg0) {
        if ( arg0 == null ) {
            return null;
        }

        List<OnlineRuleVo> list = new ArrayList<OnlineRuleVo>( arg0.size() );
        for ( OnlineRule onlineRule : arg0 ) {
            list.add( fromModel( onlineRule ) );
        }

        return list;
    }

    @Override
    public List<OnlineRule> toModelList(List<OnlineRuleVo> arg0) {
        if ( arg0 == null ) {
            return null;
        }

        List<OnlineRule> list = new ArrayList<OnlineRule>( arg0.size() );
        for ( OnlineRuleVo onlineRuleVo : arg0 ) {
            list.add( toModel( onlineRuleVo ) );
        }

        return list;
    }

    @Override
    public OnlineRule toModel(OnlineRuleVo onlineRuleVo) {
        if ( onlineRuleVo == null ) {
            return null;
        }

        OnlineRule onlineRule = new OnlineRule();

        onlineRule.setRuleId( onlineRuleVo.getRuleId() );
        onlineRule.setRuleName( onlineRuleVo.getRuleName() );
        onlineRule.setRuleType( onlineRuleVo.getRuleType() );
        onlineRule.setBuiltin( onlineRuleVo.getBuiltin() );
        onlineRule.setPattern( onlineRuleVo.getPattern() );
        onlineRule.setUpdateTime( onlineRuleVo.getUpdateTime() );
        onlineRule.setCreateTime( onlineRuleVo.getCreateTime() );
        onlineRule.setRuleTypeDictMap( mapToMap( onlineRuleVo.getRuleTypeDictMap() ) );

        onlineRule.setOnlineColumnRule( mapToBean(onlineRuleVo.getOnlineColumnRule(), com.ankaibei.workFlow.common.online.model.OnlineColumnRule.class) );

        return onlineRule;
    }

    @Override
    public OnlineRuleVo fromModel(OnlineRule onlineRule) {
        if ( onlineRule == null ) {
            return null;
        }

        OnlineRuleVo onlineRuleVo = new OnlineRuleVo();

        onlineRuleVo.setRuleId( onlineRule.getRuleId() );
        onlineRuleVo.setRuleName( onlineRule.getRuleName() );
        onlineRuleVo.setRuleType( onlineRule.getRuleType() );
        onlineRuleVo.setBuiltin( onlineRule.getBuiltin() );
        onlineRuleVo.setPattern( onlineRule.getPattern() );
        onlineRuleVo.setUpdateTime( onlineRule.getUpdateTime() );
        onlineRuleVo.setCreateTime( onlineRule.getCreateTime() );
        onlineRuleVo.setRuleTypeDictMap( mapToMap( onlineRule.getRuleTypeDictMap() ) );

        onlineRuleVo.setOnlineColumnRule( beanToMap(onlineRule.getOnlineColumnRule(), false) );

        return onlineRuleVo;
    }
}
