package api

import (
	"fmt"
	"hakushi-crawl/utils"
	"log"
)

func GetCharacterInfoApi(avatarId string, locale string) (*any, error) {
	url := fmt.Sprintf(
		"https://api.hakush.in/hsr/data/%s/character/%s.json",
		locale,
		avatarId,
	)

	data, err := utils.GetĐataJSON[any](url)
	if err != nil {
		log.Println(err)
		return nil, nil
	}

	return data, nil
}

func GetListCharacterApi() (map[string]*any, error) {
	url := "https://api.hakush.in/hsr/data/character.json"

	data, err := utils.GetĐataJSON[map[string]*any](url)
	if err != nil {
		log.Println(err)
		return nil, nil
	}

	return *data, nil
}
