//
// Artist / album image fetch. Returns raw bytes that gfx/images.jai can decode
// with stb_image and upload to a Simp.Texture.
//
// Endpoints:
//   GET /Items/{itemId}/Images/Primary   — square thumb/album art
//   GET /Items/{itemId}/Images/Backdrop/0 — 16:9 artist backdrop
//

fetch_primary_image :: (c: *Jellyfin_Client, item_id: string) -> string, bool {
    if !c.logged_in  return "", false;
    path := tprint("/Items/%/Images/Primary", item_id);
    resp := http_get(c, path);
    if !resp.ok  return "", false;
    return resp.body, true;
}

fetch_backdrop_image :: (c: *Jellyfin_Client, item_id: string) -> string, bool {
    if !c.logged_in  return "", false;
    // Backdrop/0 fetches the first (usually highest-rated) backdrop image
    path := tprint("/Items/%/Images/Backdrop/0?fillWidth=1920&fillHeight=1080&quality=85", item_id);
    resp := http_get(c, path);
    if !resp.ok  return "", false;
    return resp.body, true;
}
