package com.xindazhou.business.convert.version;

import com.xindazhou.framework.common.pojo.PageResult;
import com.xindazhou.business.controller.admin.version.vo.VersionRespVO;
import com.xindazhou.business.controller.admin.version.vo.VersionSaveReqVO;
import com.xindazhou.business.controller.app.version.vo.AppVersionRespVO;
import com.xindazhou.business.dal.dataobject.version.VersionDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 版本管理 Convert
 *
 * @author xindazhou
 */
@Mapper
public interface VersionConvert {

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

    VersionDO convert(VersionSaveReqVO bean);

    VersionRespVO convert(VersionDO bean);

    PageResult<VersionRespVO> convertPage(PageResult<VersionDO> page);

    List<VersionRespVO> convertList(List<VersionDO> list);

    // hasUpdate 字段在 AppVersionController 中手动设置，这里忽略
    @Mapping(target = "hasUpdate", ignore = true)
    AppVersionRespVO convertApp(VersionDO bean);

}

