package config

import "testing"

func TestDefaultHostSalaryCronTasksAreEnabled(t *testing.T) {
	cfg := Default()
	for _, name := range []string{
		"host_salary_daily_settlement",
		"host_salary_half_month_settlement",
		"host_salary_month_end",
	} {
		task, ok := cfg.Tasks[name]
		if !ok {
			t.Fatalf("host salary cron task %s missing", name)
		}
		if !task.Enabled {
			t.Fatalf("host salary cron task %s should be enabled globally; policy settlement_mode decides who is processed", name)
		}
	}
}

func TestDefaultCPIntimacyLeaderboardCronTaskRunsEveryFiveMinutes(t *testing.T) {
	cfg := Default()
	task, ok := cfg.Tasks["cp_intimacy_leaderboard"]
	if !ok {
		t.Fatal("cp intimacy leaderboard cron task missing")
	}
	if !task.Enabled {
		t.Fatal("cp intimacy leaderboard cron task should be enabled by default")
	}
	if task.Interval != "5m" || task.LockTTL != "5m" || task.BatchSize != 10000 {
		t.Fatalf("cp intimacy leaderboard cron task has unexpected defaults: %+v", task)
	}
}

func TestDefaultVIPDailyCoinRebateIsEnabled(t *testing.T) {
	task, ok := Default().Tasks["vip_daily_coin_rebate"]
	if !ok || !task.Enabled || task.Interval != "1m" || task.BatchSize != 500 {
		t.Fatalf("VIP daily coin rebate task mismatch: %+v", task)
	}
}
