import com.red.circle.OtherServiceApplication;
import com.red.circle.order.inner.model.enums.MonthlyRechargeType;
import com.red.circle.other.app.service.game.HotGameServiceImpl;
import com.red.circle.other.infra.database.rds.service.activity.UserActivityRechargeService;
import com.red.circle.other.infra.database.rds.service.game.GameVipLevelWeeklyService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.math.BigDecimal;

@Slf4j
@SpringBootTest(classes = OtherServiceApplication.class)
@RunWith(SpringRunner.class)
public class GameVipLevelTest {

    @Autowired
    private HotGameServiceImpl hotGameService;

    @Autowired
    private UserActivityRechargeService userActivityRechargeService;

    @Autowired
    private GameVipLevelWeeklyService gameVipLevelWeeklyService;

    private static final Long TEST_USER_ID = 1957345312961527809L;
    private static final Long ACTIVITY_ID = 1235571533988298753L;

    @Test
    public void testGetVipLevel() {
        Integer vipLevel = hotGameService.getVipLevel(TEST_USER_ID, "");
        log.info("用户VIP等级: userId={}, vipLevel={}", TEST_USER_ID, vipLevel);
    }

    @Test
    public void testRecordRecharge() {
        userActivityRechargeService.recordRecharge(TEST_USER_ID, new BigDecimal("100"), MonthlyRechargeType.SHIPPING_AGENT);
        log.info("记录充值完成: userId={}, amount=100", TEST_USER_ID);
    }

    @Test
    public void testGetVipLevelAfterRecharge() {
        userActivityRechargeService.recordRecharge(TEST_USER_ID, new BigDecimal("500"), MonthlyRechargeType.SHIPPING_AGENT);
        Integer vipLevel = hotGameService.getVipLevel(TEST_USER_ID, "");
        log.info("充值后VIP等级: userId={}, vipLevel={}", TEST_USER_ID, vipLevel);
    }
}
