package api

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

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

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

	return data, nil
}

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

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

	return *data, nil
}
