$screenshots * @param array $movies * @param array $developers * @param array $genres * @param array $categories * @param array $platforms * @param array $requirements * @param array $dlcIds */ public function __construct( public int $steamId, public string $title, public string $type = 'game', public ?string $description = null, public ?string $detailedDescription = null, public ?string $about = null, public ?string $coverUrl = null, public ?string $backdropUrl = null, public array $screenshots = [], public array $movies = [], public ?string $trailerUrl = null, public ?string $publisher = null, public array $developers = [], public ?string $releaseDate = null, public array $genres = [], public array $categories = [], public ?int $metacriticScore = null, public ?string $metacriticUrl = null, public ?SteamPriceData $price = null, public array $platforms = [], public array $requirements = [], public array $dlcIds = [], public ?int $achievementCount = null, public ?int $recommendationCount = null, public ?string $website = null, public ?string $supportUrl = null, public string $storeUrl = '', ) {} /** * Create from Steam API response array. * * Thin facade kept for backwards compatibility; delegates to * {@see SteamGameDataFactory::make()}. * * @param array $data */ public static function fromApiResponse(array $data, int $appId): self { return (new SteamGameDataFactory)->make($data, $appId); } /** * Convert to array format compatible with existing GamesInfo model. * * @return array */ public function toGamesInfoArray(): array { return [ 'title' => $this->title, 'asin' => (string) $this->steamId, 'url' => $this->storeUrl, 'publisher' => $this->publisher ?? 'Unknown', 'releasedate' => $this->releaseDate, 'review' => $this->description ?? 'No description available', 'cover' => ! empty($this->coverUrl) ? 1 : 0, 'backdrop' => ! empty($this->backdropUrl) ? 1 : 0, 'trailer' => $this->trailerUrl ?? '', 'classused' => 'Steam', 'esrb' => $this->metacriticScore !== null ? (string) $this->metacriticScore : 'Not Rated', 'coverurl' => $this->coverUrl, 'backdropurl' => $this->backdropUrl, 'genres' => implode(',', $this->genres), ]; } /** * Check if this is a game (not DLC, video, etc.). */ public function isGame(): bool { return in_array($this->type, ['game', 'demo'], true); } /** * Check if game is free. */ public function isFree(): bool { return $this->price !== null && $this->price->final <= 0; } /** * Get primary genre. */ public function getPrimaryGenre(): ?string { return $this->genres[0] ?? null; } /** * Check if game supports a platform. */ public function supportsPlatform(string $platform): bool { return in_array($platform, $this->platforms, true); } /** * Check if game has multiplayer. */ public function hasMultiplayer(): bool { $multiplayerCategories = ['Multi-player', 'Online Multi-Player', 'Online Co-op', 'Local Multi-Player', 'Local Co-op']; return ! empty(array_intersect($multiplayerCategories, $this->categories)); } /** * Check if game supports Steam Workshop. */ public function hasSteamWorkshop(): bool { return in_array('Steam Workshop', $this->categories, true); } /** * Get formatted genres string. */ public function getGenresString(): string { return implode(', ', $this->genres); } }