package gameapi

import (
	"testing"

	gamev1 "hyapp.local/api/proto/game/v1"
)

func TestRoomRPSConfigDataFromProtoIncludesGiftAnimationURL(t *testing.T) {
	data := roomRPSConfigDataFromProto(&gamev1.RoomRPSConfigResponse{
		Config: &gamev1.RoomRPSConfig{
			AppCode: "lalu",
			GameId:  "room_rps",
			Status:  "active",
			StakeGifts: []*gamev1.RoomRPSStakeGift{
				{
					GiftIdText:       "87",
					GiftName:         "彩蛋兔",
					GiftIconUrl:      "https://cdn.example.test/gifts/egg-rabbit.png",
					GiftAnimationUrl: "https://cdn.example.test/gifts/egg-rabbit.mp4",
					GiftPriceCoin:    40000,
					Enabled:          true,
					SortOrder:        1,
				},
			},
		},
		ServerTimeMs: 1770000000000,
	})

	if len(data.Config.StakeGifts) != 1 {
		t.Fatalf("expected one stake gift, got %+v", data.Config.StakeGifts)
	}
	got := data.Config.StakeGifts[0]
	if got.GiftIconURL != "https://cdn.example.test/gifts/egg-rabbit.png" || got.GiftAnimationURL != "https://cdn.example.test/gifts/egg-rabbit.mp4" {
		t.Fatalf("room rps stake gift media fields mismatch: %+v", got)
	}
}
