package activityapi

import "testing"

func TestFirstRechargeRewardItemsSplitCoverImageAndPreviewAsset(t *testing.T) {
	items := firstRechargeRewardItemsFromGroup(checkinResourceGroupData{
		Items: []checkinResourceGroupItemData{{
			ResourceID: 88001,
			Resource: &checkinResourceData{
				ResourceID:   88001,
				ResourceType: "vehicle",
				Name:         "Rocket Car",
				PreviewURL:   "https://cdn.example.test/first-recharge/rocket-cover.png",
				AssetURL:     "https://cdn.example.test/first-recharge/rocket-preview.mp4",
			},
			Quantity:   1,
			DurationMS: 604800000,
		}},
	})

	if len(items) != 1 {
		t.Fatalf("reward item count = %d", len(items))
	}
	if items[0].CoverURL != "https://cdn.example.test/first-recharge/rocket-cover.png" {
		t.Fatalf("cover_url should stay static image, got %q", items[0].CoverURL)
	}
	if items[0].AssetURL != "https://cdn.example.test/first-recharge/rocket-preview.mp4" {
		t.Fatalf("asset_url should carry mp4 preview asset, got %q", items[0].AssetURL)
	}
	if items[0].EffectURL != "https://cdn.example.test/first-recharge/rocket-preview.mp4" {
		t.Fatalf("effect_url should keep old preview fallback, got %q", items[0].EffectURL)
	}
}
