package com.jeesharp.business.modules.setting.convert;

import com.jeesharp.business.modules.setting.dto.AppSplashAdSaveDTO;
import com.jeesharp.business.modules.setting.entity.AppSplashAd;
import com.jeesharp.business.modules.setting.enums.SplashMediaTypeEnum;
import com.jeesharp.business.modules.setting.vo.AppSplashAdVO;
import com.jeesharp.business.modules.setting.vo.AppSplashAdListVO;
import com.jeesharp.business.modules.setting.vo.AppSplashAdQueryVO;
import com.jeesharp.framework.common.pojo.convert.BasePojoConvert;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;

/**
 * 开屏广告 MapStruct 转换器。
 *
 * @author jeesharp
 * @since 2026-04-21
 */
@Mapper
public interface AppSplashAdConvert extends BasePojoConvert<AppSplashAd, AppSplashAdSaveDTO, AppSplashAdVO, AppSplashAdListVO, AppSplashAdQueryVO> {

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

    @Named("mediaTypeToName")
    default String mediaTypeToName(Integer mediaType) {
        SplashMediaTypeEnum e = SplashMediaTypeEnum.fromValue(mediaType);
        return e != null ? e.getDesc() : "";
    }
}
