package com.lideeyunji.service.infra.config.convert.config;

import com.lideeyunji.tool.framework.common.pojo.PageResult;
import com.lideeyunji.service.infra.controller.vo.config.ConfigRespVO;
import com.lideeyunji.service.infra.controller.vo.config.ConfigSaveReqVO;
import com.lideeyunji.service.infra.entity.ConfigDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface ConfigConvert {

    ConfigConvert INSTANCE = Mappers.getMapper(ConfigConvert.class);

    PageResult<ConfigRespVO> convertPage(PageResult<ConfigDO> page);

    List<ConfigRespVO> convertList(List<ConfigDO> list);

    @Mapping(source = "configKey", target = "key")
    ConfigRespVO convert(ConfigDO bean);

    @Mapping(source = "key", target = "configKey")
    ConfigDO convert(ConfigSaveReqVO bean);

}
