* @category Class * @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License * @link www.splendidbear.org * @since 2026. 04. 21. * * @extends PersistentProxyObjectFactory */ class PlayedGameFactory extends PersistentProxyObjectFactory { protected function defaults(): array { return [ 'uuid' => Uuid::v4(), 'gameAssoc' => self::faker()->uuid(), 'redPoints' => self::faker()->numberBetween(0, 51), 'bluePoints' => self::faker()->numberBetween(0, 51), 'redExplodedBomb' => false, 'blueExplodedBomb' => false, 'resign' => null, 'redBonusPoints' => self::faker()->randomFloat(2, 0, 100), 'blueBonusPoints' => self::faker()->randomFloat(2, 0, 100), 'redBonusStats' => null, 'blueBonusStats' => null, 'created' => new DateTime(), 'updated' => new DateTime(), ]; } public static function class(): string { return PlayedGame::class; } public function withRegisteredPlayers(): self { return $this->with([ 'red' => UserFactory::new(), 'blue' => UserFactory::new(), ]); } public function withAnonymousPlayers(): self { return $this->with([ 'redAnon' => GamerFactory::new(), 'blueAnon' => GamerFactory::new(), ]); } public function withMixedPlayers(): self { return $this->with([ 'red' => UserFactory::new(), 'blueAnon' => GamerFactory::new(), ]); } public function finished(): self { return $this->with([ 'redPoints' => 26, 'bluePoints' => 25, ]); } public function redWins(): self { return $this->with([ 'redPoints' => 26, 'bluePoints' => self::faker()->numberBetween(0, 25), ]); } public function blueWins(): self { return $this->with([ 'redPoints' => self::faker()->numberBetween(0, 25), 'bluePoints' => 26, ]); } public function resigned(string $player): self { return $this->with(['resign' => $player]); } }