package com.red.circle.other.app.command.game.luckygift;

import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import com.red.circle.other.app.common.gift.GameLuckyGiftCommon;
import com.red.circle.other.app.dto.cmd.game.GameLuckyGiftCmd;
import com.red.circle.other.infra.database.cache.service.other.GameLuckyGiftCacheService;
import com.red.circle.other.infra.database.cache.service.other.GiftCacheService;
import com.red.circle.other.infra.database.rds.service.game.LuckyGiftProbabilityDetailsService;
import com.red.circle.other.infra.database.rds.service.game.LuckyGiftProbabilityService;
import com.red.circle.other.inner.model.dto.material.GiftConfigDTO;
import org.junit.jupiter.api.Test;

class LuckyGiftDataQryCmdTest {

  @Test
  void execute_shouldReturnNullWhenGiftIsDownShelved() {
    GiftCacheService giftCacheService = mock(GiftCacheService.class);
    GameLuckyGiftCommon gameLuckyGiftCommon = mock(GameLuckyGiftCommon.class);
    GameLuckyGiftCacheService gameLuckyGiftCacheService = mock(GameLuckyGiftCacheService.class);
    LuckyGiftProbabilityService luckyGiftProbabilityService = mock(LuckyGiftProbabilityService.class);
    LuckyGiftProbabilityDetailsService luckyGiftProbabilityDetailsService = mock(
        LuckyGiftProbabilityDetailsService.class);
    LuckyGiftDataQryCmd qryCmd = new LuckyGiftDataQryCmd(
        giftCacheService,
        gameLuckyGiftCommon,
        gameLuckyGiftCacheService,
        luckyGiftProbabilityService,
        luckyGiftProbabilityDetailsService
    );

    when(giftCacheService.getById(11L)).thenReturn(new GiftConfigDTO()
        .setId(11L)
        .setDel(Boolean.TRUE)
        .setStandardId(99L));

    GameLuckyGiftCmd cmd = new GameLuckyGiftCmd();
    cmd.setGiftId(11L);

    assertNull(qryCmd.execute(cmd));
  }
}
