// Metro module 4211 (f4212). import Record from "../../lib/Record"; import ApplicationRecord, { createExecutable } from "../../records/ApplicationRecord"; import { GameLinkTypes } from "../../flow/Server"; import getGameMediaRefURL from "./getGameMediaRefURL"; import { SUPPORTS_WEBP } from "../../utils/AvatarUtils"; import { isNotNullish } from "../../utils/GlobalUtils"; class GameRecord extends Record { constructor(a0) { super(); this.id = a0.id; this.name = a0.name; this.description = a0.description; let aliases = a0.aliases; if (aliases == null) { aliases = []; } this.aliases = aliases; let executables = a0.executables; if (executables == null) { executables = []; } this.executables = executables.map(createExecutable); let overlay = a0.overlay; if (overlay == null) { overlay = false; } this.overlay = overlay; let overlay_warn = a0.overlay_warn; if (overlay_warn == null) { overlay_warn = false; } this.overlayWarn = overlay_warn; let overlay_compatibility_hook = a0.overlay_compatibility_hook; if (overlay_compatibility_hook == null) { overlay_compatibility_hook = false; } this.overlayCompatibilityHook = overlay_compatibility_hook; let hook = a0.hook; if (hook == null) { hook = true; } this.hook = hook; this.supportsOutOfProcessOverlay = ApplicationRecord.supportsOutOfProcessOverlay(a0.overlay_methods); let third_party_skus = a0.third_party_skus; if (third_party_skus == null) { third_party_skus = []; } this.thirdPartySkus = third_party_skus; let themes = a0.themes; if (themes == null) { themes = []; } this.themes = themes; this.linkedApplications = a0.linked_applications; let genres = a0.genres; if (genres == null) { genres = []; } this.genres = genres; let platforms = a0.platforms; if (platforms == null) { platforms = []; } this.platforms = platforms; let websites = a0.websites; if (websites == null) { websites = []; } this.websites = websites; this.companies = a0.companies; this.screenshotHashes = a0.screenshot_hashes; this.screenshotUrls = a0.screenshot_urls; this.trailers = a0.trailers; this.l30Rank = a0.l30_rank; this.summaryLocalized = a0.summary_localized; this.media = a0.media; this.firstReleaseDate = a0.first_release_date; this.shopCollectionIds = a0.shop_collection_ids; this.steamReleaseStatus = a0.steam_release_status; const reviews = a0.reviews; this.reviews = reviews?.steam == null ? reviews?.opencritic != null ? { steam: reviews.steam != null ? { rating: reviews.steam.rating, ratingCount: reviews.steam.rating_count, recentRating: reviews.steam.recent_rating, recentRatingCount: reviews.steam.recent_rating_count, localizedRating: reviews.steam.localized_rating, localizedRatingCount: reviews.steam.localized_rating_count } : void 0, opencritic: reviews.opencritic != null ? { topCriticRating: reviews.opencritic.top_critic_rating, topCriticRatingCount: reviews.opencritic.top_critic_rating_count, tier: reviews.opencritic.tier } : void 0 } : void 0 : { steam: reviews.steam != null ? { rating: reviews.steam.rating, ratingCount: reviews.steam.rating_count, recentRating: reviews.steam.recent_rating, recentRatingCount: reviews.steam.recent_rating_count, localizedRating: reviews.steam.localized_rating, localizedRatingCount: reviews.steam.localized_rating_count } : void 0, opencritic: reviews.opencritic != null ? { topCriticRating: reviews.opencritic.top_critic_rating, topCriticRatingCount: reviews.opencritic.top_critic_rating_count, tier: reviews.opencritic.tier } : void 0 }; this.opencriticUrl = a0.opencritic_url; let game_flags = a0.game_flags; if (game_flags == null) { game_flags = 0; } this.gameFlags = game_flags; this.contentClassification = a0.content_classification; } get applicationId() { return this.id; } getOfficialApplicationId() { const linkedApplications = this.linkedApplications; return linkedApplications == null ? void 0 : linkedApplications.find((linkedApplication) => linkedApplication.type === GameLinkTypes.OFFICIAL)?.id; } getIconURL(a0, a1) { return getGameMediaRefURL(this.id, this.media?.icon, { size: a0, format: a1 }); } getBannerURL(a0) { return getGameMediaRefURL(this.id, this.media?.banner, { keepAspectRatio: true, size: a0 }); } getCoverURL(a0) { return getGameMediaRefURL(this.id, this.media?.cover, { keepAspectRatio: true, format: SUPPORTS_WEBP ? "webp" : "png", size: a0 }); } getArtworkURLs() { let r6 = this.media?.artwork; if (r6 == null) { r6 = []; } return r6.map((item) => getGameMediaRefURL(this.id, item, { keepAspectRatio: true })).filter(isNotNullish); } getCompanyByRole(c13990_0) { const companies = this.companies; let r7 = companies == null ? void 0 : companies.filter((company) => company.roles.includes(c13990_0)); if (r7 == null) { r7 = []; } return r7; } } export default GameRecord;