package com.xindazhou.user.convert.level;

import com.xindazhou.framework.common.pojo.PageResult;
import com.xindazhou.user.api.level.dto.MemberLevelRespDTO;
import com.xindazhou.user.controller.admin.level.vo.level.MemberLevelCreateReqVO;
import com.xindazhou.user.controller.admin.level.vo.level.MemberLevelRespVO;
import com.xindazhou.user.controller.admin.level.vo.level.MemberLevelSimpleRespVO;
import com.xindazhou.user.controller.admin.level.vo.level.MemberLevelUpdateReqVO;
import com.xindazhou.user.controller.app.level.vo.level.AppMemberLevelRespVO;
import com.xindazhou.user.dal.dataobject.level.MemberLevelDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 会员等级 Convert
 *
 * @author owen
 */
@Mapper
public interface MemberLevelConvert {

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

    MemberLevelDO convert(MemberLevelCreateReqVO bean);

    MemberLevelDO convert(MemberLevelUpdateReqVO bean);

    MemberLevelRespVO convert(MemberLevelDO bean);

    List<MemberLevelRespVO> convertList(List<MemberLevelDO> list);

    default PageResult<MemberLevelRespVO> convertPage(PageResult<MemberLevelDO> pageResult) {
        return new PageResult<>(convertList(pageResult.getList()), pageResult.getTotal());
    }

    List<MemberLevelSimpleRespVO> convertSimpleList(List<MemberLevelDO> list);

    List<AppMemberLevelRespVO> convertList02(List<MemberLevelDO> list);

    MemberLevelRespDTO convert02(MemberLevelDO bean);

}
