package com.red.circle.game.fruit.application.convertor;

import com.red.circle.framework.core.convertor.ConvertorModel;
import com.red.circle.game.fruit.application.dto.clientobject.GameFruitBountyConfigCO;
import com.red.circle.game.fruit.application.dto.clientobject.GameFruitTaskAwardConfigCO;
import com.red.circle.game.fruit.infrastructure.database.entity.GameFruitBountyConfig;
import com.red.circle.game.fruit.infrastructure.database.entity.GameFruitTaskAwardConfig;
import com.red.circle.game.fruit.inner.model.dto.GameFruitBountyConfigDTO;
import com.red.circle.game.fruit.inner.model.dto.GameFruitTaskConfigDTO;
import java.util.List;
import org.mapstruct.Mapper;

/**
 * @author zongpubin on 2023/12/13
 */
@Mapper(componentModel = ConvertorModel.SPRING)
public interface GameFruitTaskAppConvertor {

  GameFruitBountyConfigDTO toGameFruitBountyConfigDTO(GameFruitBountyConfig gameFruitBountyConfig);

  GameFruitBountyConfig toGameFruitBountyConfig(GameFruitBountyConfigDTO param);

  default GameFruitTaskConfigDTO toGameFruitTaskConfigDTO(
      GameFruitTaskAwardConfig awardConfig) {
    return new GameFruitTaskConfigDTO()
        .setTaskType(awardConfig.getTaskType())
        .setSysOrigin(awardConfig.getSysOrigin())
        .setId(awardConfig.getId())
        .setBountyId(awardConfig.getBountyId())
        .setQuantity(awardConfig.getQuantity())
        .setQuantityDays(awardConfig.getQuantityDays())
        .setResourceGroupId(awardConfig.getResourceGroupId())
        .setSort(awardConfig.getSort())
        .setCreateTime(awardConfig.getCreateTime())
        ;
  }

  default GameFruitTaskAwardConfig toGameFruitTaskAwardConfig(GameFruitTaskConfigDTO param) {
    return new GameFruitTaskAwardConfig()
        .setId(param.getId())
        .setTaskType(param.getTaskType())
        .setBountyId(param.getBountyId())
        .setSysOrigin(param.getSysOrigin())
        .setResourceGroupId(param.getResourceGroupId())
        .setQuantity(param.getQuantity())
        .setQuantityDays(param.getQuantityDays())
        .setSort(param.getSort());
  }

  List<GameFruitBountyConfigCO> toGameFruitBountyConfigCO(
      List<GameFruitBountyConfig> bountyConfigs);

  List<GameFruitTaskAwardConfigCO> toListGameFruitTaskAwardConfigCO(
      List<GameFruitTaskAwardConfig> awardConfigs);
}
